mainnet-js 1.1.7 → 1.1.8
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/index.html +1 -1
- package/dist/{mainnet-1.1.7.js → mainnet-1.1.8.js} +1 -1
- package/dist/module/wallet/Bcmr.d.ts +1 -1
- package/dist/module/wallet/Bcmr.d.ts.map +1 -1
- package/dist/module/wallet/Bcmr.js +9 -22
- package/dist/module/wallet/Bcmr.js.map +1 -1
- package/dist/module/wallet/Wif.d.ts +1 -1
- package/dist/module/wallet/bcmr-v2.schema.d.ts +833 -0
- package/dist/module/wallet/bcmr-v2.schema.d.ts.map +1 -0
- package/dist/module/wallet/bcmr-v2.schema.js +2 -0
- package/dist/module/wallet/bcmr-v2.schema.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/wallet/Bcmr.test.headless.js +47 -15
- package/src/wallet/Bcmr.test.ts +28 -15
- package/src/wallet/Bcmr.ts +12 -25
- package/src/wallet/Wif.ts +1 -1
- package/src/wallet/bcmr-v2.schema.ts +893 -0
- package/dist/module/wallet/bcmr-v1.schema.d.ts +0 -623
- package/dist/module/wallet/bcmr-v1.schema.d.ts.map +0 -1
- package/dist/module/wallet/bcmr-v1.schema.js +0 -2
- package/dist/module/wallet/bcmr-v1.schema.js.map +0 -1
- package/src/wallet/bcmr-v1.schema.ts +0 -639
|
@@ -1,639 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A mapping of identifiers to URIs associated with an entity. URI identifiers
|
|
3
|
-
* may be widely-standardized or registry-specific. Values must be valid URIs,
|
|
4
|
-
* including a protocol prefix – e.g. `https://` or `ipfs://`., Clients are only
|
|
5
|
-
* required to support `https` and `ipfs` URIs, but any scheme may be specified.
|
|
6
|
-
*/
|
|
7
|
-
export type URIs = {
|
|
8
|
-
[identifier: string]: string;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* A mapping of extension identifiers to extension definitions. Extensions may
|
|
13
|
-
* be widely standardized or registry-specific, and extension definitions may
|
|
14
|
-
* be values of any type.
|
|
15
|
-
*/
|
|
16
|
-
export type Extensions = {
|
|
17
|
-
[identifier: string]: unknown;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Tags allow registries to classify and group identities by a variety of
|
|
22
|
-
* characteristics. Tags are standardized within a registry and may represent
|
|
23
|
-
* either labels applied by that registry or designations by external
|
|
24
|
-
* authorities (certification, membership, ownership, etc.) that are tracked by
|
|
25
|
-
* that registry.
|
|
26
|
-
*
|
|
27
|
-
* Examples of possible tags include: `individual`, `organization`, `token`,
|
|
28
|
-
* `wallet`, `exchange`, `staking`, `utility-token`, `security-token`,
|
|
29
|
-
* `stablecoin`, `wrapped`, `collectable`, `deflationary`, `governance`,
|
|
30
|
-
* `decentralized-exchange`, `liquidity-provider`, `sidechain`,
|
|
31
|
-
* `sidechain-bridge`, `acme-audited`, `acme-endorsed`, etc.
|
|
32
|
-
*
|
|
33
|
-
* Tags may be used by clients in search, discovery, and filtering of
|
|
34
|
-
* identities, and they can also convey information like accreditation from
|
|
35
|
-
* investor protection organizations, public certifications by security or
|
|
36
|
-
* financial auditors, and other designations that signal integrity and value
|
|
37
|
-
* to users.
|
|
38
|
-
*/
|
|
39
|
-
export type Tag = {
|
|
40
|
-
/**
|
|
41
|
-
* The name of this tag for use in interfaces. Names longer than `20`
|
|
42
|
-
* characters may be elided in some interfaces.
|
|
43
|
-
*
|
|
44
|
-
* E.g. `Individual`, `Token`, `Audited by ACME, Inc.`, etc.
|
|
45
|
-
*/
|
|
46
|
-
name: string;
|
|
47
|
-
/**
|
|
48
|
-
* A string describing this tag for use in user interfaces. Descriptions
|
|
49
|
-
* longer than `160` characters may be elided in some interfaces.
|
|
50
|
-
*
|
|
51
|
-
* E.g. `An identity maintained by a single individual.`; `An identity
|
|
52
|
-
* representing a type of token.`; `An on-chain application that has passed
|
|
53
|
-
* security audits by ACME, Inc.`; etc.
|
|
54
|
-
*/
|
|
55
|
-
description?: string;
|
|
56
|
-
/**
|
|
57
|
-
* A mapping of identifiers to URIs associated with this tag. URI identifiers
|
|
58
|
-
* may be widely-standardized or registry-specific. Values must be valid URIs,
|
|
59
|
-
* including a protocol prefix (e.g. `https://` or `ipfs://`). Clients are
|
|
60
|
-
* only required to support `https` and `ipfs` URIs, but any scheme may
|
|
61
|
-
* be specified.
|
|
62
|
-
*
|
|
63
|
-
* The following identifiers are recommended for all tags:
|
|
64
|
-
* - `icon`
|
|
65
|
-
* - `web`
|
|
66
|
-
*
|
|
67
|
-
* The following optional identifiers are standardized:
|
|
68
|
-
* - `blog`
|
|
69
|
-
* - `chat`
|
|
70
|
-
* - `forum`
|
|
71
|
-
* - `icon-intro`
|
|
72
|
-
* - `registry`
|
|
73
|
-
* - `support`
|
|
74
|
-
*
|
|
75
|
-
* For details on these standard identifiers, see:
|
|
76
|
-
* https://github.com/bitjson/chip-bcmr#uri-identifiers
|
|
77
|
-
*
|
|
78
|
-
* Custom URI identifiers allow for sharing social networking profiles, p2p
|
|
79
|
-
* connection information, and other application-specific URIs. Identifiers
|
|
80
|
-
* must be lowercase, alphanumeric strings, with no whitespace or special
|
|
81
|
-
* characters other than dashes (as a regular expression: `/^[-a-z0-9]+$/`).
|
|
82
|
-
*
|
|
83
|
-
* For example, some common identifiers include: `discord`, `docker`,
|
|
84
|
-
* `facebook`, `git`, `github`, `gitter`, `instagram`, `linkedin`, `matrix`,
|
|
85
|
-
* `npm`, `reddit`, `slack`, `substack`, `telegram`, `twitter`, `wechat`,
|
|
86
|
-
* `youtube`.
|
|
87
|
-
*/
|
|
88
|
-
uris?: URIs;
|
|
89
|
-
/**
|
|
90
|
-
* A mapping of `Tag` extension identifiers to extension definitions.
|
|
91
|
-
* Extensions may be widely standardized or registry-specific, and extension
|
|
92
|
-
* definitions may be values of any type.
|
|
93
|
-
*/
|
|
94
|
-
extensions?: Extensions;
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* A Bitcoin Cash Metadata Registry is an authenticated JSON file containing
|
|
99
|
-
* metadata about tokens, identities, contract applications, and other on-chain
|
|
100
|
-
* artifacts. BCMRs conform to the Bitcoin Cash Metadata Registry JSON Schema,
|
|
101
|
-
* and they can be published and maintained by any entity or individual.
|
|
102
|
-
*/
|
|
103
|
-
export type Registry = {
|
|
104
|
-
/**
|
|
105
|
-
* The schema used by this registry. Many JSON editors can automatically
|
|
106
|
-
* provide inline documentation and autocomplete support using the `$schema`
|
|
107
|
-
* property, so it is recommended that registries include it. E.g.:
|
|
108
|
-
* `https://raw.githubusercontent.com/bitjson/chip-bcmr/master/registry-v1.schema.json`
|
|
109
|
-
*/
|
|
110
|
-
$schema?: string;
|
|
111
|
-
/**
|
|
112
|
-
* The version of this registry. Versioning adheres to Semantic Versioning
|
|
113
|
-
* (https://semver.org/).
|
|
114
|
-
*/
|
|
115
|
-
version: {
|
|
116
|
-
/**
|
|
117
|
-
* The major version is incremented when an identity is removed.
|
|
118
|
-
*/
|
|
119
|
-
major: number;
|
|
120
|
-
/**
|
|
121
|
-
* The minor version is incremented when an identity is added or a new
|
|
122
|
-
* identity snapshot is added.
|
|
123
|
-
*/
|
|
124
|
-
minor: number;
|
|
125
|
-
/**
|
|
126
|
-
* The patch version is incremented when an existing identity or identity
|
|
127
|
-
* snapshot is modified (e.g. to correct an error or add a missing piece of
|
|
128
|
-
* information) or when other registry properties (e.g. registry `name`,
|
|
129
|
-
* `description`, `uris`, etc.) are modified.
|
|
130
|
-
*
|
|
131
|
-
* Generally, substantive changes to an existing identity should be made
|
|
132
|
-
* using a new identity snapshot in a minor version upgrade – this allows
|
|
133
|
-
* clients to provide a better user experience by noting the change in
|
|
134
|
-
* relevant user interfaces.
|
|
135
|
-
*
|
|
136
|
-
* For example, patch upgrades might include spelling corrections in an
|
|
137
|
-
* existing snapshot or the addition of an `icon-svg` containing a
|
|
138
|
-
* higher-resolution version of an existing `icon` image. On the other hand,
|
|
139
|
-
* a rebranding in which the icon is substantially changed may warrant a new
|
|
140
|
-
* identity snapshot to be added in a minor version upgrade.
|
|
141
|
-
*/
|
|
142
|
-
patch: number;
|
|
143
|
-
};
|
|
144
|
-
/**
|
|
145
|
-
* The timestamp of the latest revision made to this registry version. The
|
|
146
|
-
* timestamp must be provided in simplified extended ISO 8601 format, a
|
|
147
|
-
* 24-character string of format `YYYY-MM-DDTHH:mm:ss.sssZ` where timezone is
|
|
148
|
-
* zero UTC (denoted by `Z`). Note, this is the format returned by ECMAScript
|
|
149
|
-
* `Date.toISOString()`.
|
|
150
|
-
*/
|
|
151
|
-
latestRevision: string;
|
|
152
|
-
/**
|
|
153
|
-
* The identity information of this particular registry, provided as either an
|
|
154
|
-
* authbase (recommended) or an `IdentitySnapshot`.
|
|
155
|
-
*
|
|
156
|
-
* An authbase is a 32-byte, hex-encoded transaction hash (A.K.A. TXID) for
|
|
157
|
-
* which the zeroth-descendant transaction chain (ZDTC) authenticates and
|
|
158
|
-
* publishes all registry updates. If an authbase is provided, the registry's
|
|
159
|
-
* identity information can be found in `identities[authbase]`, and clients
|
|
160
|
-
* should immediately attempt to verify the registry's identity on-chain.
|
|
161
|
-
* (See https://github.com/bitjson/chip-bcmr#chain-resolved-registries)
|
|
162
|
-
*
|
|
163
|
-
* If an `IdentitySnapshot` is provided directly, this registry does not
|
|
164
|
-
* support on-chain resolution/authentication, and the contained
|
|
165
|
-
* `IdentitySnapshot` can only be authenticated via DNS/HTTPS.
|
|
166
|
-
*/
|
|
167
|
-
registryIdentity: string | IdentitySnapshot;
|
|
168
|
-
/**
|
|
169
|
-
* A mapping of authbases to the `IdentityHistory` for that identity.
|
|
170
|
-
*
|
|
171
|
-
* An authbase is a 32-byte, hex-encoded transaction hash (A.K.A. TXID) for
|
|
172
|
-
* which the zeroth-descendant transaction chain (ZDTC) authenticates and
|
|
173
|
-
* publishes an identity's claimed metadata.
|
|
174
|
-
*
|
|
175
|
-
* Identities may represent metadata registries, specific types of tokens,
|
|
176
|
-
* companies, organizations, individuals, or other on-chain entities.
|
|
177
|
-
*/
|
|
178
|
-
identities?: {
|
|
179
|
-
[authbase: string]: IdentityHistory;
|
|
180
|
-
};
|
|
181
|
-
/**
|
|
182
|
-
* A map of registry-specific `Tag`s used by this registry to convey
|
|
183
|
-
* information about identities it tracks.
|
|
184
|
-
*
|
|
185
|
-
* Tags allow registries to group identities into collections of related
|
|
186
|
-
* identities, marking characteristics or those identities. Tags are
|
|
187
|
-
* standardized within a registry and may represent either labels applied by
|
|
188
|
-
* that registry (e.g. `individual`, `organization`, `token`, `wallet`,
|
|
189
|
-
* `exchange`, `staking`, `utility-token`, `security-token`, `stablecoin`,
|
|
190
|
-
* `wrapped`, `collectable`, `deflationary`, `governance`,
|
|
191
|
-
* `decentralized-exchange`, `liquidity-provider`, `sidechain`,
|
|
192
|
-
* `sidechain-bridge`, etc.) or designations by external authorities
|
|
193
|
-
* (certification, membership, ownership, etc.) that are tracked by
|
|
194
|
-
* that registry.
|
|
195
|
-
*
|
|
196
|
-
* Tags may be used by clients in search, discover, and filtering of
|
|
197
|
-
* identities, and they can also convey information like accreditation from
|
|
198
|
-
* investor protection organizations, public certifications by security or
|
|
199
|
-
* financial auditors, and other designations that signal legitimacy and value
|
|
200
|
-
* to users.
|
|
201
|
-
*/
|
|
202
|
-
tags?: {
|
|
203
|
-
[identifier: string]: Tag;
|
|
204
|
-
};
|
|
205
|
-
/**
|
|
206
|
-
* A mapping of `Registry` extension identifiers to extension definitions.
|
|
207
|
-
* Extensions may be widely standardized or registry-specific, and extension
|
|
208
|
-
* definitions may be values of any type.
|
|
209
|
-
*
|
|
210
|
-
* Standardized extensions for `Registry`s include the `locale` extension. See
|
|
211
|
-
* https://github.com/bitjson/chip-bcmr#locales-extension for details.
|
|
212
|
-
*/
|
|
213
|
-
extensions?: Extensions;
|
|
214
|
-
/**
|
|
215
|
-
* The license under which this registry is published. This may be specified
|
|
216
|
-
* as either a SPDX short identifier (https://spdx.org/licenses/) or by
|
|
217
|
-
* including the full text of the license.
|
|
218
|
-
*
|
|
219
|
-
* Common values include:
|
|
220
|
-
* - `CC0-1.0`: https://creativecommons.org/publicdomain/zero/1.0/
|
|
221
|
-
* - `MIT`: https://opensource.org/licenses/MIT
|
|
222
|
-
*/
|
|
223
|
-
license?: string;
|
|
224
|
-
};
|
|
225
|
-
|
|
226
|
-
/**
|
|
227
|
-
* A snapshot of the metadata for a particular identity at a specific time.
|
|
228
|
-
*
|
|
229
|
-
*/
|
|
230
|
-
export type IdentitySnapshot = {
|
|
231
|
-
/**
|
|
232
|
-
* The name of this identity for use in interfaces. Names longer than
|
|
233
|
-
* `20` characters may be elided in some interfaces.
|
|
234
|
-
*
|
|
235
|
-
* E.g. `ACME Class A Shares`, `ACME Registry`, `Satoshi Nakamoto`, etc.
|
|
236
|
-
*/
|
|
237
|
-
name: string;
|
|
238
|
-
/**
|
|
239
|
-
* A string describing this identity for use in user interfaces.
|
|
240
|
-
* Descriptions longer than `160` characters may be elided in some interfaces.
|
|
241
|
-
*
|
|
242
|
-
* E.g. `The common stock issued by ACME, Inc.`, `A metadata
|
|
243
|
-
* registry maintained by Company Name, the embedded registry for Wallet
|
|
244
|
-
* Name.`; `Software developer and lead maintainer of Wallet Name.`; etc.
|
|
245
|
-
*/
|
|
246
|
-
description?: string;
|
|
247
|
-
/**
|
|
248
|
-
* An array of `Tag` identifiers marking the `Tag`s associated with this
|
|
249
|
-
* identity. All specified tag identifiers must be defined in the registry's
|
|
250
|
-
* `tags` mapping.
|
|
251
|
-
*/
|
|
252
|
-
tags?: string[];
|
|
253
|
-
/**
|
|
254
|
-
* The timing information for the introduction of this identity snapshot.
|
|
255
|
-
* Each timestamps may be provided as either an ISO string (simplified
|
|
256
|
-
* extended ISO 8601 format) or as a locktime value: an integer from `0` to
|
|
257
|
-
* `4294967295` (inclusive) where values less than `500000000` are understood
|
|
258
|
-
* to be a block height (the current block number in the chain, beginning from
|
|
259
|
-
* block `0`), and values greater than or equal to `500000000` are understood
|
|
260
|
-
* to be a Median Time Past (BIP113) UNIX timestamp.
|
|
261
|
-
*
|
|
262
|
-
* Generally, timestamps should be provided as an ISO string unless on-chain
|
|
263
|
-
* artifacts require the locktime value (e.g. an on-chain migration that is
|
|
264
|
-
* set to complete at a particular locktime value).
|
|
265
|
-
*/
|
|
266
|
-
time: {
|
|
267
|
-
/**
|
|
268
|
-
* The timestamp at which this identity snapshot begins to be active. If
|
|
269
|
-
* `complete` isn't specified, this is a precise time at which this
|
|
270
|
-
* snapshot takes effect and clients should begin using the new information.
|
|
271
|
-
*/
|
|
272
|
-
begin: string | number;
|
|
273
|
-
/**
|
|
274
|
-
* The timestamp at which this identity snapshot is fully in effect. This
|
|
275
|
-
* value should only be provided if the snapshot takes effect over a period
|
|
276
|
-
* of time (e.g. an in-circulation token identity is gradually migrating to
|
|
277
|
-
* a new category). In these cases, clients should gradually migrate to
|
|
278
|
-
* using the new information beginning after the `begin` time and completing
|
|
279
|
-
* at the `complete` time.
|
|
280
|
-
*/
|
|
281
|
-
complete?: string | number;
|
|
282
|
-
};
|
|
283
|
-
/**
|
|
284
|
-
* If this identity is a type of token, a data structure indicating how tokens
|
|
285
|
-
* should be displayed in user interfaces. Omitted for non-token identities.
|
|
286
|
-
*/
|
|
287
|
-
token?: {
|
|
288
|
-
/**
|
|
289
|
-
* The current token category used by this identity. Often, this will be
|
|
290
|
-
* equal to the identities authbase, but some token identities must migrate
|
|
291
|
-
* to new categories for technical reasons.
|
|
292
|
-
*/
|
|
293
|
-
category: string;
|
|
294
|
-
/**
|
|
295
|
-
* An abbreviation used to uniquely identity this token category.
|
|
296
|
-
*
|
|
297
|
-
* Symbols must be comprised only of capital letters, numbers, and dashes
|
|
298
|
-
* (`-`). This can be validated with the regular expression:
|
|
299
|
-
* `/^[-A-Z0-9]+$/`.
|
|
300
|
-
*/
|
|
301
|
-
symbol: string;
|
|
302
|
-
/**
|
|
303
|
-
* An integer between `0` and `18` (inclusive) indicating the divisibility
|
|
304
|
-
* of the primary unit of this token category.
|
|
305
|
-
*
|
|
306
|
-
* This is the number of digits that can appear after the decimal separator
|
|
307
|
-
* in fungible token amounts. For a token category with a `symbol` of
|
|
308
|
-
* `SYMBOL` and a `decimals` of `2`, a fungible token amount of `12345`
|
|
309
|
-
* should be displayed as `123.45 SYMBOL`.
|
|
310
|
-
*
|
|
311
|
-
* If omitted, defaults to `0`.
|
|
312
|
-
*/
|
|
313
|
-
decimals?: number;
|
|
314
|
-
/**
|
|
315
|
-
* Display information for non-fungible tokens (NFTs) of this identity.
|
|
316
|
-
* Omitted for token categories without NFTs.
|
|
317
|
-
*/
|
|
318
|
-
nfts?: {
|
|
319
|
-
/**
|
|
320
|
-
* A string describing how this identity uses NFTs (for use in user
|
|
321
|
-
* interfaces). Descriptions longer than `160` characters may be elided in
|
|
322
|
-
* some interfaces.
|
|
323
|
-
*
|
|
324
|
-
* E.g. `ACME DEX NFT order receipts are issued when you place orders on
|
|
325
|
-
* the decentralized exchange. After orders are processed, order receipts
|
|
326
|
-
* can be redeemed for purchased tokens or sales proceeds.`; `ACME Game
|
|
327
|
-
* collectable NFTs unlock unique playable content, user avatars, and item
|
|
328
|
-
* skins in ACME Game Online.`; etc.
|
|
329
|
-
*/
|
|
330
|
-
description?: string;
|
|
331
|
-
/**
|
|
332
|
-
* A mapping of field identifier to field definitions for the data fields
|
|
333
|
-
* that can appear in NFT commitments of this category.
|
|
334
|
-
*/
|
|
335
|
-
fields: {
|
|
336
|
-
[identifier: string]: {
|
|
337
|
-
/**
|
|
338
|
-
* The name of this field for use in interfaces. Names longer than
|
|
339
|
-
* `20` characters may be elided in some interfaces.
|
|
340
|
-
*
|
|
341
|
-
* E.g. `BCH Pledged`, `Tokens Sold`, `Seat Number`,
|
|
342
|
-
* `IPFS Content Identifier`, `HTTPS URL` etc.
|
|
343
|
-
*/
|
|
344
|
-
name?: string;
|
|
345
|
-
/**
|
|
346
|
-
* A string describing how this identity uses NFTs (for use in user
|
|
347
|
-
* interfaces). Descriptions longer than `160` characters may be
|
|
348
|
-
* elided in some interfaces.
|
|
349
|
-
*
|
|
350
|
-
* E.g. `The BCH value pledged at the time this receipt was issued.`;
|
|
351
|
-
* `The number of tokens sold in this order.`; `The seat number
|
|
352
|
-
* associated with this ticket.`; `The IPFS`
|
|
353
|
-
* collectable NFTs unlock unique playable content, user avatars, and item
|
|
354
|
-
* skins in ACME Game Online.`; etc.
|
|
355
|
-
*/
|
|
356
|
-
description?: string;
|
|
357
|
-
/**
|
|
358
|
-
* The expected encoding of this field when read from the parsing
|
|
359
|
-
* altstack (see `token.nft.parse`). All encoding definitions must
|
|
360
|
-
* have a `type`, and some encoding definitions allow for additional
|
|
361
|
-
* hinting about display strategies in clients.
|
|
362
|
-
*
|
|
363
|
-
* Encoding types may be set to `binary`, `boolean`, `hex`, `number`,
|
|
364
|
-
* or `utf8`:
|
|
365
|
-
*
|
|
366
|
-
* - `binary` types should be displayed as binary literals (e.g.
|
|
367
|
-
* `0b0101`)
|
|
368
|
-
* - `boolean` types should be displayed as `true` if exactly `0x01`
|
|
369
|
-
* or `false` if exactly `0x00`. If a boolean value does not match one
|
|
370
|
-
* of these values, clients should represent the NFT as unable to be
|
|
371
|
-
* parsed (e.g. simply display the full `commitment`).
|
|
372
|
-
* - `hex` types should be displayed as hex literals (e.g.`0xabcd`).
|
|
373
|
-
* - `https-url` types are percent encoded with the `https://` prefix
|
|
374
|
-
* omitted; they may be displayed as URIs or as activatable links.
|
|
375
|
-
* - `ipfs-cid` types are binary-encoded IPFS Content Identifiers;
|
|
376
|
-
* they may be displayed as URIs or as activatable links.
|
|
377
|
-
* - `locktime` types are `OP_TXLOCKTIME` results: integers from `0`
|
|
378
|
-
* to `4294967295` (inclusive) where values less than `500000000` are
|
|
379
|
-
* understood to be a block height (the current block number in the
|
|
380
|
-
* chain, beginning from block `0`), and values greater than or equal
|
|
381
|
-
* to `500000000` are understood to be a Median Time Past (BIP113)
|
|
382
|
-
* UNIX timestamp. (Note, sequence age is not currently supported.)
|
|
383
|
-
* - `number` types should be displayed according the their configured
|
|
384
|
-
* `decimals` and `unit` values.
|
|
385
|
-
* - `utf8` types should be displayed as utf8 strings.
|
|
386
|
-
*/
|
|
387
|
-
encoding:
|
|
388
|
-
| {
|
|
389
|
-
type:
|
|
390
|
-
| "binary"
|
|
391
|
-
| "boolean"
|
|
392
|
-
| "hex"
|
|
393
|
-
| "https-url"
|
|
394
|
-
| "ipfs-cid"
|
|
395
|
-
| `locktime`
|
|
396
|
-
| "utf8";
|
|
397
|
-
}
|
|
398
|
-
| {
|
|
399
|
-
type: "number";
|
|
400
|
-
/**
|
|
401
|
-
* The `aggregate` property indicates that aggregating this
|
|
402
|
-
* field from multiple NFTs is desirable in user interfaces. For
|
|
403
|
-
* example, for a field named `BCH Pledged` where `aggregate` is
|
|
404
|
-
* `add`, the client can display a `Total BCH Pledged` in any
|
|
405
|
-
* user interface listing more than one NFT.
|
|
406
|
-
*
|
|
407
|
-
* If specified, clients should aggregate the field from all
|
|
408
|
-
* NFTs within a view (e.g. NFTs held by a single wallet, NFTs
|
|
409
|
-
* existing in a single transaction's outputs, etc.) using the
|
|
410
|
-
* specified operation. Note, while aggregation could be
|
|
411
|
-
* performed using any commutative operation – multiplication,
|
|
412
|
-
* bitwise AND, bitwise OR, and bitwise XOR, etc. – only `add`
|
|
413
|
-
* is currently supported.
|
|
414
|
-
*/
|
|
415
|
-
aggregate?: "add";
|
|
416
|
-
/**
|
|
417
|
-
* An integer between `0` and `18` (inclusive) indicating the
|
|
418
|
-
* divisibility of the primary unit of this token field.
|
|
419
|
-
*
|
|
420
|
-
* This is the number of digits that can appear after the
|
|
421
|
-
* decimal separator in amounts. For a field with a `decimals`
|
|
422
|
-
* of `2`, a value of `123456` should be displayed as `1234.56`.
|
|
423
|
-
*
|
|
424
|
-
* If omitted, defaults to `0`.
|
|
425
|
-
*/
|
|
426
|
-
decimals?: number;
|
|
427
|
-
/**
|
|
428
|
-
* The unit in which this field is denominated, taking the
|
|
429
|
-
* `decimals` value into account. If representing fungible token
|
|
430
|
-
* amount, this will often be the symbol of the represented
|
|
431
|
-
* token category.
|
|
432
|
-
*
|
|
433
|
-
* E.g. `BCH`, `sats`, `AcmeUSD`, etc.
|
|
434
|
-
*
|
|
435
|
-
* If not provided, clients should not represent this field as
|
|
436
|
-
* having a unit beyond the field's `name`.
|
|
437
|
-
*/
|
|
438
|
-
unit?: string;
|
|
439
|
-
};
|
|
440
|
-
/**
|
|
441
|
-
* A mapping of identifiers to URIs associated with this NFT field.
|
|
442
|
-
* URI identifiers may be widely-standardized or registry-specific.
|
|
443
|
-
* Values must be valid URIs, including a protocol prefix (e.g.
|
|
444
|
-
* `https://` or `ipfs://`). Clients are only required to support
|
|
445
|
-
* `https` and `ipfs` URIs, but any scheme may be specified.
|
|
446
|
-
*/
|
|
447
|
-
uris?: URIs;
|
|
448
|
-
/**
|
|
449
|
-
* A mapping of NFT field extension identifiers to extension
|
|
450
|
-
* definitions. Extensions may be widely standardized or
|
|
451
|
-
* registry-specific, and extension definitions may be values of
|
|
452
|
-
* any type.
|
|
453
|
-
*/
|
|
454
|
-
extensions?: Extensions;
|
|
455
|
-
};
|
|
456
|
-
};
|
|
457
|
-
/**
|
|
458
|
-
* Parsing and interpretation information for all NFTs of this category.
|
|
459
|
-
*
|
|
460
|
-
* Parsing instructions are provided in the `bytecode` property, and the
|
|
461
|
-
* results are interpreted using the `types` property.
|
|
462
|
-
*/
|
|
463
|
-
parse: {
|
|
464
|
-
/**
|
|
465
|
-
* A segment of hex-encoded Bitcoin Cash VM bytecode that parses NFT
|
|
466
|
-
* commitments of this category and returns a list of NFT field values
|
|
467
|
-
* via the altstack. The `bytecode` is taken as locking bytecode
|
|
468
|
-
* evaluated after pushing the full NFT commitment to the stack (as if
|
|
469
|
-
* pushed in a single-operation unlocking bytecode).
|
|
470
|
-
*
|
|
471
|
-
* If the resulting stack is not valid (a single "truthy" element
|
|
472
|
-
* remaining on the stack) – or if the altstack is empty – parsing has
|
|
473
|
-
* failed and clients should represent the NFT as unable to be parsed
|
|
474
|
-
* (e.g. simply display the full `commitment`).
|
|
475
|
-
*
|
|
476
|
-
* On successful parsing evaluations, the bottom item on the altstack
|
|
477
|
-
* indicates the type of the NFT according to the matching definition in
|
|
478
|
-
* `types`. If no match is found, clients should represent the NFT as
|
|
479
|
-
* unable to be parsed.
|
|
480
|
-
*/
|
|
481
|
-
bytecode: string;
|
|
482
|
-
/**
|
|
483
|
-
* A mapping of hex-encoded values to definitions of possible NFT types
|
|
484
|
-
* in this category.
|
|
485
|
-
*/
|
|
486
|
-
types: {
|
|
487
|
-
/**
|
|
488
|
-
* A definition for one type of NFT within a token category. NFT types
|
|
489
|
-
* are indexed by the expected hex-encoded value of the bottom
|
|
490
|
-
* altstack item following evaluation of `token.nft.parse.bytecode`.
|
|
491
|
-
* The remaining altstack items are mapped to NFT fields according to
|
|
492
|
-
* the `fields` property of the matching NFT type.
|
|
493
|
-
*/
|
|
494
|
-
[bottomAltStackItemHex: string]: {
|
|
495
|
-
/**
|
|
496
|
-
* The name of this NFT type for use in interfaces. Names longer than
|
|
497
|
-
* `20` characters may be elided in some interfaces.
|
|
498
|
-
*
|
|
499
|
-
* E.g. `Market Order Buys`, `Limit Order Sales`, `Pledge Receipts`,
|
|
500
|
-
* `ACME Stadium Tickets`, `Sealed Votes`, etc.
|
|
501
|
-
*/
|
|
502
|
-
name: string;
|
|
503
|
-
/**
|
|
504
|
-
* A string describing this NFT type for use in user interfaces.
|
|
505
|
-
* Descriptions longer than `160` characters may be elided in
|
|
506
|
-
* some interfaces.
|
|
507
|
-
*
|
|
508
|
-
* E.g. `Receipts issued by the exchange to record details about
|
|
509
|
-
* purchases. After settlement, these receipts are redeemed for the
|
|
510
|
-
* purchased tokens.`; `Receipts issued by the crowdfunding campaign
|
|
511
|
-
* to document the value of funds pledged. If the user decides to
|
|
512
|
-
* cancel their pledge before the campaign completes, these receipts
|
|
513
|
-
* can be redeemed for a full refund.`; `Tickets issued for events
|
|
514
|
-
* at ACME Stadium.`; `Sealed ballots certified by ACME
|
|
515
|
-
* decentralized organization during the voting period. After the
|
|
516
|
-
* voting period ends, these ballots must be revealed to reclaim the
|
|
517
|
-
* tokens used for voting.`; etc.
|
|
518
|
-
*/
|
|
519
|
-
description?: string;
|
|
520
|
-
/**
|
|
521
|
-
* A list of identifiers for fields contained in NFTs of this type.
|
|
522
|
-
* On successful parsing evaluations, the bottom item on the
|
|
523
|
-
* altstack indicates the matched NFT type, and the remaining
|
|
524
|
-
* altstack items represent NFT field contents in the order listed
|
|
525
|
-
* (where `fields[0]` is the second-to-bottom item, and the final
|
|
526
|
-
* item in `fields` is the top of the altstack).
|
|
527
|
-
*
|
|
528
|
-
* Fields should be ordered by recommended importance from most
|
|
529
|
-
* important to least important; in user interfaces, clients should
|
|
530
|
-
* display fields at lower indexes more prominently than those at
|
|
531
|
-
* higher indexes, e.g. if some fields cannot be displayed in
|
|
532
|
-
* minimized interfaces, higher-importance fields can still be
|
|
533
|
-
* represented. (Note, this ordering is controlled by the bytecode
|
|
534
|
-
* specified in `token.nft.parse.bytecode`.)
|
|
535
|
-
*/
|
|
536
|
-
fields: string[];
|
|
537
|
-
/**
|
|
538
|
-
* A mapping of identifiers to URIs associated with this NFT type.
|
|
539
|
-
* URI identifiers may be widely-standardized or registry-specific.
|
|
540
|
-
* Values must be valid URIs, including a protocol prefix (e.g.
|
|
541
|
-
* `https://` or `ipfs://`). Clients are only required to support
|
|
542
|
-
* `https` and `ipfs` URIs, but any scheme may be specified.
|
|
543
|
-
*/
|
|
544
|
-
uris?: URIs;
|
|
545
|
-
/**
|
|
546
|
-
* A mapping of NFT type extension identifiers to extension
|
|
547
|
-
* definitions. Extensions may be widely standardized or
|
|
548
|
-
* registry-specific, and extension definitions may be values of
|
|
549
|
-
* any type.
|
|
550
|
-
*/
|
|
551
|
-
extensions?: Extensions;
|
|
552
|
-
};
|
|
553
|
-
};
|
|
554
|
-
};
|
|
555
|
-
};
|
|
556
|
-
};
|
|
557
|
-
|
|
558
|
-
/**
|
|
559
|
-
* The status of this identity, must be `active`, `inactive`, or `burned`. If
|
|
560
|
-
* omitted, defaults to `active`.
|
|
561
|
-
* - Identities with an `active` status should be actively tracked by clients.
|
|
562
|
-
* - Identities with an `inactive` status may be considered for archival by
|
|
563
|
-
* clients and may be removed in future registry versions.
|
|
564
|
-
* - Identities with a `burned` status have been destroyed by setting the
|
|
565
|
-
* latest identity output to a data-carrier output (`OP_RETURN`), permanently
|
|
566
|
-
* terminating the authchain. Clients should archive burned identities and –
|
|
567
|
-
* if the burned identity represented a token type – consider burning any
|
|
568
|
-
* remaining tokens of that category to reclaim funds from those outputs.
|
|
569
|
-
*/
|
|
570
|
-
status?: "active" | "inactive" | "burned";
|
|
571
|
-
|
|
572
|
-
/**
|
|
573
|
-
* A mapping of identifiers to URIs associated with this identity. URI
|
|
574
|
-
* identifiers may be widely-standardized or registry-specific. Values must be
|
|
575
|
-
* valid URIs, including a protocol prefix (e.g. `https://` or `ipfs://`).
|
|
576
|
-
* Clients are only required to support `https` and `ipfs` URIs, but any
|
|
577
|
-
* scheme may be specified.
|
|
578
|
-
*
|
|
579
|
-
* The following identifiers are recommended for all identities:
|
|
580
|
-
* - `icon`
|
|
581
|
-
* - `web`
|
|
582
|
-
*
|
|
583
|
-
* The following optional identifiers are standardized:
|
|
584
|
-
* - `blog`
|
|
585
|
-
* - `chat`
|
|
586
|
-
* - `forum`
|
|
587
|
-
* - `icon-intro`
|
|
588
|
-
* - `registry`
|
|
589
|
-
* - `support`
|
|
590
|
-
*
|
|
591
|
-
* For details on these standard identifiers, see:
|
|
592
|
-
* https://github.com/bitjson/chip-bcmr#uri-identifiers
|
|
593
|
-
*
|
|
594
|
-
* Custom URI identifiers allow for sharing social networking profiles, p2p
|
|
595
|
-
* connection information, and other application-specific URIs. Identifiers
|
|
596
|
-
* must be lowercase, alphanumeric strings, with no whitespace or special
|
|
597
|
-
* characters other than dashes (as a regular expression: `/^[-a-z0-9]+$/`).
|
|
598
|
-
*
|
|
599
|
-
* For example, some common identifiers include: `discord`, `docker`,
|
|
600
|
-
* `facebook`, `git`, `github`, `gitter`, `instagram`, `linkedin`, `matrix`,
|
|
601
|
-
* `npm`, `reddit`, `slack`, `substack`, `telegram`, `twitter`, `wechat`,
|
|
602
|
-
* `youtube`.
|
|
603
|
-
*/
|
|
604
|
-
uris?: URIs;
|
|
605
|
-
|
|
606
|
-
/**
|
|
607
|
-
* A mapping of `IdentitySnapshot` extension identifiers to extension
|
|
608
|
-
* definitions. Extensions may be widely standardized or registry-specific,
|
|
609
|
-
* and extension definitions may be values of any type.
|
|
610
|
-
*
|
|
611
|
-
* Standardized extensions for `IdentitySnapshot`s include the `authchain`
|
|
612
|
-
* extension. See
|
|
613
|
-
* https://github.com/bitjson/chip-bcmr#authchain-extension for details.
|
|
614
|
-
*/
|
|
615
|
-
extensions?: Extensions;
|
|
616
|
-
};
|
|
617
|
-
|
|
618
|
-
/**
|
|
619
|
-
* An array of `IdentitySnapshot`s, ordered from newest to oldest documenting
|
|
620
|
-
* the evolution of a particular identity. Typically, the current identity
|
|
621
|
-
* information is the record at index `0`, but in cases where a planned
|
|
622
|
-
* migration has not yet begun (the snapshot's `time.begin` has not been
|
|
623
|
-
* reached), the record at index `1` is considered the current identity.
|
|
624
|
-
*
|
|
625
|
-
* This strategy allows wallets and other user interfaces to offer better
|
|
626
|
-
* experiences when an identity is rebranded, a token redenominated, or other
|
|
627
|
-
* important metadata is modified in a coordinated update. For example, a wallet
|
|
628
|
-
* may warn token holders of a forthcoming rebranding of fungible tokens they
|
|
629
|
-
* hold; after the change, the wallet may continue to offer prominent interface
|
|
630
|
-
* hints that the rebranded tokens was recently updated.
|
|
631
|
-
*
|
|
632
|
-
* Note, only the `IdentitySnapshot`s at index `0` and `1` can be considered
|
|
633
|
-
* part of an identities "current" information (based on their `time` settings
|
|
634
|
-
* in relation to current time). E.g. even if two snapshots have active,
|
|
635
|
-
* overlapping migration periods (i.e. the snapshot at `2` is still relevant for
|
|
636
|
-
* the snapshot at `1`), clients should only attempt to display the migration
|
|
637
|
-
* from the snapshot at index `1` to that at index `0`.
|
|
638
|
-
*/
|
|
639
|
-
export type IdentityHistory = IdentitySnapshot[];
|