@taquito/tzip12 24.2.0-beta.1 → 24.3.0-beta.0

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.
@@ -1,290 +1,241 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@taquito/michelson-encoder'), require('@taquito/tzip16'), require('@taquito/utils'), require('@taquito/core')) :
3
- typeof define === 'function' && define.amd ? define(['exports', '@taquito/michelson-encoder', '@taquito/tzip16', '@taquito/utils', '@taquito/core'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.taquitoTzip12 = {}, global.michelsonEncoder, global.tzip16, global.utils, global.taquitoCore));
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@taquito/michelson-encoder'), require('@taquito/tzip16'), require('@taquito/utils'), require('@taquito/core')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', '@taquito/michelson-encoder', '@taquito/tzip16', '@taquito/utils', '@taquito/core'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.taquitoTzip12 = {}, global.michelsonEncoder, global.tzip16, global.utils, global.taquitoCore));
5
5
  })(this, (function (exports, michelsonEncoder, tzip16, utils, core) { 'use strict';
6
6
 
7
- /******************************************************************************
8
- Copyright (c) Microsoft Corporation.
9
-
10
- Permission to use, copy, modify, and/or distribute this software for any
11
- purpose with or without fee is hereby granted.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
14
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
15
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
16
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
17
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
18
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19
- PERFORMANCE OF THIS SOFTWARE.
20
- ***************************************************************************** */
21
- /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
22
-
23
-
24
- function __awaiter(thisArg, _arguments, P, generator) {
25
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
26
- return new (P || (P = Promise))(function (resolve, reject) {
27
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
28
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
29
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
30
- step((generator = generator.apply(thisArg, _arguments || [])).next());
31
- });
32
- }
33
-
34
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
35
- var e = new Error(message);
36
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
37
- };
7
+ /**
8
+ * @category Error
9
+ * Error that indicates the metadata not being found on the contract
10
+ */
11
+ class TokenMetadataNotFound extends core.TaquitoError {
12
+ constructor(address) {
13
+ super();
14
+ this.address = address;
15
+ this.name = 'TokenMetadataNotFound';
16
+ this.message = `No token metadata was found for the contract: ${address}`;
17
+ }
18
+ }
19
+ /**
20
+ * @category Error
21
+ * Error that indicates the token ID not being found
22
+ */
23
+ class TokenIdNotFound extends core.TaquitoError {
24
+ constructor(tokenId) {
25
+ super(`Could not find token metadata for the token ID: ${tokenId}`);
26
+ this.tokenId = tokenId;
27
+ this.name = 'TokenIdNotFound';
28
+ }
29
+ }
30
+ /**
31
+ * @category Error
32
+ * Error that indicates that the token metadata is invalid (not compliant with the TZIP-12 standard)
33
+ */
34
+ class InvalidTokenMetadata extends core.TaquitoError {
35
+ constructor(invalidMetadata) {
36
+ super();
37
+ this.invalidMetadata = invalidMetadata;
38
+ this.name = 'InvalidTokenMetadata';
39
+ this.message =
40
+ 'Non-compliance with the TZIP-012 standard. The required property `decimals` is missing.';
41
+ }
42
+ }
38
43
 
39
- /**
40
- * @category Error
41
- * @description Error that indicates the metadata not being found on the contract
42
- */
43
- class TokenMetadataNotFound extends core.TaquitoError {
44
- constructor(address) {
45
- super();
46
- this.address = address;
47
- this.name = 'TokenMetadataNotFound';
48
- this.message = `No token metadata was found for the contract: ${address}`;
49
- }
50
- }
51
- /**
52
- * @category Error
53
- * @description Error that indicates the token ID not being found
54
- */
55
- class TokenIdNotFound extends core.TaquitoError {
56
- constructor(tokenId) {
57
- super(`Could not find token metadata for the token ID: ${tokenId}`);
58
- this.tokenId = tokenId;
59
- this.name = 'TokenIdNotFound';
60
- }
61
- }
62
- /**
63
- * @category Error
64
- * @description Error that indicates that the token metadata is invalid (not compliant with the TZIP-12 standard)
65
- */
66
- class InvalidTokenMetadata extends core.TaquitoError {
67
- constructor(invalidMetadata) {
68
- super();
69
- this.invalidMetadata = invalidMetadata;
70
- this.name = 'InvalidTokenMetadata';
71
- this.message =
72
- 'Non-compliance with the TZIP-012 standard. The required property `decimals` is missing.';
73
- }
74
- }
44
+ const tokenMetadataBigMapType = {
45
+ prim: 'big_map',
46
+ args: [
47
+ { prim: 'nat' },
48
+ {
49
+ prim: 'pair',
50
+ args: [
51
+ { prim: 'nat', annots: ['%token_id'] },
52
+ { prim: 'map', args: [{ prim: 'string' }, { prim: 'bytes' }], annots: ['%token_info'] },
53
+ ],
54
+ },
55
+ ],
56
+ annots: ['%token_metadata'],
57
+ };
58
+ class Tzip12ContractAbstraction {
59
+ constructor(contractAbstraction, context) {
60
+ this.contractAbstraction = contractAbstraction;
61
+ this.context = context;
62
+ this._tzip16ContractAbstraction = new tzip16.Tzip16ContractAbstraction(this.contractAbstraction, this.context);
63
+ }
64
+ /**
65
+ * Fetches the contract metadata (according to the Tzip-016 standard)
66
+ * @returns An object containing the metadata, the uri, an optional integrity check result and an optional sha256 hash
67
+ * or `Undefined` if the contract has no metadata (non-compliant with Tzip-016)
68
+ */
69
+ async getContractMetadata() {
70
+ try {
71
+ const contractMetadata = await this._tzip16ContractAbstraction.getMetadata();
72
+ return contractMetadata.metadata;
73
+ }
74
+ catch (err) {
75
+ // The contract is not compliant with Tzip-016. There is no contract metadata.
76
+ }
77
+ }
78
+ /**
79
+ * The Tzip-016 "interfaces" field MUST be present in the contract metadata. It should contain "TZIP-012[version-info]"
80
+ * @returns True if "interfaces" field is present and contains "TZIP-012", false otherwise
81
+ */
82
+ async isTzip12Compliant() {
83
+ let isCompliant = false;
84
+ const metadata = await this.getContractMetadata();
85
+ if (metadata) {
86
+ const tzip12Interface = metadata.interfaces?.filter((x) => {
87
+ return x.substring(0, 8) === 'TZIP-012';
88
+ });
89
+ isCompliant = tzip12Interface && tzip12Interface.length !== 0 ? true : false;
90
+ }
91
+ return isCompliant;
92
+ }
93
+ /**
94
+ * Fetches the token metadata for a specified token ID.
95
+ * The function first tries to find a `token_metadata` view in the contract metadata and to execute it with the token ID.
96
+ * If there is no view, the function tries to find a `token_metadata` bigmap in the top-level pairs of the storage.
97
+ * @param tokenId The ID of the token for which we want to retrieve token metadata
98
+ * @returns An object of type `TokenMetadata`
99
+ * @throws {@link TokenIdNotFound, TokenMetadataNotFound, InvalidTokenMetadata}
100
+ */
101
+ async getTokenMetadata(tokenId) {
102
+ const tokenMetadata = await this.retrieveTokenMetadataFromView(tokenId);
103
+ return !tokenMetadata ? this.retrieveTokenMetadataFromBigMap(tokenId) : tokenMetadata;
104
+ }
105
+ async retrieveTokenMetadataFromView(tokenId) {
106
+ if (await this.getContractMetadata()) {
107
+ const views = await this._tzip16ContractAbstraction.metadataViews();
108
+ if (views && this.hasTokenMetadataView(views)) {
109
+ return this.executeTokenMetadataView(views['token_metadata'](), tokenId);
110
+ }
111
+ }
112
+ }
113
+ hasTokenMetadataView(views) {
114
+ for (const view of Object.keys(views)) {
115
+ if (view === 'token_metadata') {
116
+ return true;
117
+ }
118
+ }
119
+ return false;
120
+ }
121
+ async executeTokenMetadataView(tokenMetadataView, tokenId) {
122
+ const tokenMetadata = await tokenMetadataView.executeView(tokenId);
123
+ const tokenMap = Object.values(tokenMetadata)[1];
124
+ if (!michelsonEncoder.MichelsonMap.isMichelsonMap(tokenMap)) {
125
+ throw new TokenMetadataNotFound(this.contractAbstraction.address);
126
+ }
127
+ const metadataFromUri = await this.fetchTokenMetadataFromUri(tokenMap);
128
+ return this.formatMetadataToken(tokenId, tokenMap, metadataFromUri);
129
+ }
130
+ async fetchTokenMetadataFromUri(tokenMetadata) {
131
+ const uri = tokenMetadata.get('');
132
+ if (uri) {
133
+ try {
134
+ const metadataFromUri = await this.context.metadataProvider.provideMetadata(this.contractAbstraction, utils.bytesToString(uri), this.context);
135
+ return metadataFromUri.metadata;
136
+ }
137
+ catch (e) {
138
+ if (e.name === 'InvalidUriError') {
139
+ console.warn(`The URI ${utils.bytesToString(uri)} is present in the token metadata, but is invalid.`);
140
+ }
141
+ else {
142
+ throw e;
143
+ }
144
+ }
145
+ }
146
+ }
147
+ formatMetadataToken(tokenId, metadataTokenMap, metadataFromUri) {
148
+ const tokenMetadataDecoded = {
149
+ token_id: tokenId,
150
+ };
151
+ for (const keyTokenMetadata of metadataTokenMap.keys()) {
152
+ if (keyTokenMetadata === 'decimals') {
153
+ Object.assign(tokenMetadataDecoded, {
154
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
155
+ [keyTokenMetadata]: Number(utils.bytesToString(metadataTokenMap.get(keyTokenMetadata))),
156
+ });
157
+ }
158
+ else if (!(keyTokenMetadata === '')) {
159
+ Object.assign(tokenMetadataDecoded, {
160
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
161
+ [keyTokenMetadata]: utils.bytesToString(metadataTokenMap.get(keyTokenMetadata)),
162
+ });
163
+ }
164
+ }
165
+ // if an URI is present, add the fetched properties to the object
166
+ // if a property is in the URI and the map, prevalence is accorded to value from the URI
167
+ if (metadataFromUri) {
168
+ for (const property in metadataFromUri) {
169
+ Object.assign(tokenMetadataDecoded, { [property]: metadataFromUri[property] });
170
+ }
171
+ }
172
+ if (!('decimals' in tokenMetadataDecoded)) {
173
+ throw new InvalidTokenMetadata(tokenMetadataDecoded);
174
+ }
175
+ return tokenMetadataDecoded;
176
+ }
177
+ async retrieveTokenMetadataFromBigMap(tokenId) {
178
+ const bigmapTokenMetadataId = await this.findTokenMetadataBigMap();
179
+ let pairNatMap;
180
+ try {
181
+ pairNatMap = await this.context.contract.getBigMapKeyByID(bigmapTokenMetadataId['int'].toString(), tokenId.toString(), new michelsonEncoder.Schema(tokenMetadataBigMapType));
182
+ }
183
+ catch (err) {
184
+ throw new TokenIdNotFound(tokenId);
185
+ }
186
+ const michelsonMap = pairNatMap['token_info'];
187
+ if (!michelsonEncoder.MichelsonMap.isMichelsonMap(michelsonMap)) {
188
+ throw new TokenIdNotFound(tokenId);
189
+ }
190
+ const metadataFromUri = await this.fetchTokenMetadataFromUri(michelsonMap);
191
+ return this.formatMetadataToken(tokenId, michelsonMap, metadataFromUri);
192
+ }
193
+ async findTokenMetadataBigMap() {
194
+ const tokenMetadataBigMapId = this.contractAbstraction.schema.FindFirstInTopLevelPair(await this.context.readProvider.getStorage(this.contractAbstraction.address, 'head'), tokenMetadataBigMapType);
195
+ if (!tokenMetadataBigMapId || !tokenMetadataBigMapId.int) {
196
+ throw new TokenMetadataNotFound(this.contractAbstraction.address);
197
+ }
198
+ return { int: tokenMetadataBigMapId.int };
199
+ }
200
+ }
75
201
 
76
- const tokenMetadataBigMapType = {
77
- prim: 'big_map',
78
- args: [
79
- { prim: 'nat' },
80
- {
81
- prim: 'pair',
82
- args: [
83
- { prim: 'nat', annots: ['%token_id'] },
84
- { prim: 'map', args: [{ prim: 'string' }, { prim: 'bytes' }], annots: ['%token_info'] },
85
- ],
86
- },
87
- ],
88
- annots: ['%token_metadata'],
89
- };
90
- class Tzip12ContractAbstraction {
91
- constructor(contractAbstraction, context) {
92
- this.contractAbstraction = contractAbstraction;
93
- this.context = context;
94
- this._tzip16ContractAbstraction = new tzip16.Tzip16ContractAbstraction(this.contractAbstraction, this.context);
95
- }
96
- /**
97
- * @description Fetches the contract metadata (according to the Tzip-016 standard)
98
- * @returns An object containing the metadata, the uri, an optional integrity check result and an optional sha256 hash
99
- * or `Undefined` if the contract has no metadata (non-compliant with Tzip-016)
100
- */
101
- getContractMetadata() {
102
- return __awaiter(this, void 0, void 0, function* () {
103
- try {
104
- const contractMetadata = yield this._tzip16ContractAbstraction.getMetadata();
105
- return contractMetadata.metadata;
106
- }
107
- catch (err) {
108
- // The contract is not compliant with Tzip-016. There is no contract metadata.
109
- }
110
- });
111
- }
112
- /**
113
- * @description The Tzip-016 "interfaces" field MUST be present in the contract metadata. It should contain "TZIP-012[version-info]"
114
- * @returns True if "interfaces" field is present and contains "TZIP-012", false otherwise
115
- */
116
- isTzip12Compliant() {
117
- return __awaiter(this, void 0, void 0, function* () {
118
- var _a;
119
- let isCompliant = false;
120
- const metadata = yield this.getContractMetadata();
121
- if (metadata) {
122
- const tzip12Interface = (_a = metadata.interfaces) === null || _a === void 0 ? void 0 : _a.filter((x) => {
123
- return x.substring(0, 8) === 'TZIP-012';
124
- });
125
- isCompliant = tzip12Interface && tzip12Interface.length !== 0 ? true : false;
126
- }
127
- return isCompliant;
128
- });
129
- }
130
- /**
131
- * @description Fetches the token metadata for a specified token ID.
132
- * The function first tries to find a `token_metadata` view in the contract metadata and to execute it with the token ID.
133
- * If there is no view, the function tries to find a `token_metadata` bigmap in the top-level pairs of the storage.
134
- * @param tokenId The ID of the token for which we want to retrieve token metadata
135
- * @returns An object of type `TokenMetadata`
136
- * @throws {@link TokenIdNotFound, TokenMetadataNotFound, InvalidTokenMetadata}
137
- */
138
- getTokenMetadata(tokenId) {
139
- return __awaiter(this, void 0, void 0, function* () {
140
- const tokenMetadata = yield this.retrieveTokenMetadataFromView(tokenId);
141
- return !tokenMetadata ? this.retrieveTokenMetadataFromBigMap(tokenId) : tokenMetadata;
142
- });
143
- }
144
- retrieveTokenMetadataFromView(tokenId) {
145
- return __awaiter(this, void 0, void 0, function* () {
146
- if (yield this.getContractMetadata()) {
147
- const views = yield this._tzip16ContractAbstraction.metadataViews();
148
- if (views && this.hasTokenMetadataView(views)) {
149
- return this.executeTokenMetadataView(views['token_metadata'](), tokenId);
150
- }
151
- }
152
- });
153
- }
154
- hasTokenMetadataView(views) {
155
- for (const view of Object.keys(views)) {
156
- if (view === 'token_metadata') {
157
- return true;
158
- }
159
- }
160
- return false;
161
- }
162
- executeTokenMetadataView(tokenMetadataView, tokenId) {
163
- return __awaiter(this, void 0, void 0, function* () {
164
- const tokenMetadata = yield tokenMetadataView.executeView(tokenId);
165
- const tokenMap = Object.values(tokenMetadata)[1];
166
- if (!michelsonEncoder.MichelsonMap.isMichelsonMap(tokenMap)) {
167
- throw new TokenMetadataNotFound(this.contractAbstraction.address);
168
- }
169
- const metadataFromUri = yield this.fetchTokenMetadataFromUri(tokenMap);
170
- return this.formatMetadataToken(tokenId, tokenMap, metadataFromUri);
171
- });
172
- }
173
- fetchTokenMetadataFromUri(tokenMetadata) {
174
- return __awaiter(this, void 0, void 0, function* () {
175
- const uri = tokenMetadata.get('');
176
- if (uri) {
177
- try {
178
- const metadataFromUri = yield this.context.metadataProvider.provideMetadata(this.contractAbstraction, utils.bytesToString(uri), this.context);
179
- return metadataFromUri.metadata;
180
- }
181
- catch (e) {
182
- if (e.name === 'InvalidUriError') {
183
- console.warn(`The URI ${utils.bytesToString(uri)} is present in the token metadata, but is invalid.`);
184
- }
185
- else {
186
- throw e;
187
- }
188
- }
189
- }
190
- });
191
- }
192
- formatMetadataToken(tokenId, metadataTokenMap, metadataFromUri) {
193
- const tokenMetadataDecoded = {
194
- token_id: tokenId,
195
- };
196
- for (const keyTokenMetadata of metadataTokenMap.keys()) {
197
- if (keyTokenMetadata === 'decimals') {
198
- Object.assign(tokenMetadataDecoded, {
199
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
200
- [keyTokenMetadata]: Number(utils.bytesToString(metadataTokenMap.get(keyTokenMetadata))),
201
- });
202
- }
203
- else if (!(keyTokenMetadata === '')) {
204
- Object.assign(tokenMetadataDecoded, {
205
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
206
- [keyTokenMetadata]: utils.bytesToString(metadataTokenMap.get(keyTokenMetadata)),
207
- });
208
- }
209
- }
210
- // if an URI is present, add the fetched properties to the object
211
- // if a property is in the URI and the map, prevalence is accorded to value from the URI
212
- if (metadataFromUri) {
213
- for (const property in metadataFromUri) {
214
- Object.assign(tokenMetadataDecoded, { [property]: metadataFromUri[property] });
215
- }
216
- }
217
- if (!('decimals' in tokenMetadataDecoded)) {
218
- throw new InvalidTokenMetadata(tokenMetadataDecoded);
219
- }
220
- return tokenMetadataDecoded;
221
- }
222
- retrieveTokenMetadataFromBigMap(tokenId) {
223
- return __awaiter(this, void 0, void 0, function* () {
224
- const bigmapTokenMetadataId = yield this.findTokenMetadataBigMap();
225
- let pairNatMap;
226
- try {
227
- pairNatMap = yield this.context.contract.getBigMapKeyByID(bigmapTokenMetadataId['int'].toString(), tokenId.toString(), new michelsonEncoder.Schema(tokenMetadataBigMapType));
228
- }
229
- catch (err) {
230
- throw new TokenIdNotFound(tokenId);
231
- }
232
- const michelsonMap = pairNatMap['token_info'];
233
- if (!michelsonEncoder.MichelsonMap.isMichelsonMap(michelsonMap)) {
234
- throw new TokenIdNotFound(tokenId);
235
- }
236
- const metadataFromUri = yield this.fetchTokenMetadataFromUri(michelsonMap);
237
- return this.formatMetadataToken(tokenId, michelsonMap, metadataFromUri);
238
- });
239
- }
240
- findTokenMetadataBigMap() {
241
- return __awaiter(this, void 0, void 0, function* () {
242
- const tokenMetadataBigMapId = this.contractAbstraction.schema.FindFirstInTopLevelPair(yield this.context.readProvider.getStorage(this.contractAbstraction.address, 'head'), tokenMetadataBigMapType);
243
- if (!tokenMetadataBigMapId || !tokenMetadataBigMapId.int) {
244
- throw new TokenMetadataNotFound(this.contractAbstraction.address);
245
- }
246
- return { int: tokenMetadataBigMapId.int };
247
- });
248
- }
249
- }
202
+ const ABSTRACTION_KEY = Symbol('Tzip12ContractAbstractionObjectKey');
203
+ function tzip12(abs, context) {
204
+ return Object.assign(abs, {
205
+ // namespace tzip12
206
+ tzip12() {
207
+ if (!this[ABSTRACTION_KEY]) {
208
+ this[ABSTRACTION_KEY] = new Tzip12ContractAbstraction(this, context);
209
+ }
210
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
211
+ return this[ABSTRACTION_KEY];
212
+ },
213
+ });
214
+ }
250
215
 
251
- const ABSTRACTION_KEY = Symbol('Tzip12ContractAbstractionObjectKey');
252
- function tzip12(abs, context) {
253
- return Object.assign(abs, {
254
- // namespace tzip12
255
- tzip12() {
256
- if (!this[ABSTRACTION_KEY]) {
257
- this[ABSTRACTION_KEY] = new Tzip12ContractAbstraction(this, context);
258
- }
259
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
260
- return this[ABSTRACTION_KEY];
261
- },
262
- });
263
- }
216
+ // The same default metadataProvider is used for tzip16 and tzip12
217
+ class Tzip12Module {
218
+ constructor(metadataProvider) {
219
+ this._metadataProvider = metadataProvider ? metadataProvider : new tzip16.MetadataProvider(tzip16.DEFAULT_HANDLERS);
220
+ }
221
+ configureContext(context) {
222
+ Object.assign(context, { metadataProvider: this._metadataProvider });
223
+ }
224
+ }
264
225
 
265
- // The same default metadataProvider is used for tzip16 and tzip12
266
- class Tzip12Module {
267
- constructor(metadataProvider) {
268
- this._metadataProvider = metadataProvider ? metadataProvider : new tzip16.MetadataProvider(tzip16.DEFAULT_HANDLERS);
269
- }
270
- configureContext(context) {
271
- Object.assign(context, { metadataProvider: this._metadataProvider });
272
- }
273
- }
226
+ // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT!
227
+ const VERSION = {
228
+ "commitHash": "27675679db6515e8b092195ef5c58c2c0ea5f5c8",
229
+ "version": "24.3.0-beta.0"
230
+ };
274
231
 
275
- // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT!
276
- const VERSION = {
277
- "commitHash": "3f0dac2d1edb047928bcbe89db422d4de60f007e",
278
- "version": "24.2.0-beta.1"
279
- };
280
-
281
- exports.InvalidTokenMetadata = InvalidTokenMetadata;
282
- exports.TokenIdNotFound = TokenIdNotFound;
283
- exports.TokenMetadataNotFound = TokenMetadataNotFound;
284
- exports.Tzip12ContractAbstraction = Tzip12ContractAbstraction;
285
- exports.Tzip12Module = Tzip12Module;
286
- exports.VERSION = VERSION;
287
- exports.tzip12 = tzip12;
232
+ exports.InvalidTokenMetadata = InvalidTokenMetadata;
233
+ exports.TokenIdNotFound = TokenIdNotFound;
234
+ exports.TokenMetadataNotFound = TokenMetadataNotFound;
235
+ exports.Tzip12ContractAbstraction = Tzip12ContractAbstraction;
236
+ exports.Tzip12Module = Tzip12Module;
237
+ exports.VERSION = VERSION;
238
+ exports.tzip12 = tzip12;
288
239
 
289
240
  }));
290
241
  //# sourceMappingURL=taquito-tzip12.umd.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"taquito-tzip12.umd.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"taquito-tzip12.umd.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -2,7 +2,7 @@ import { TaquitoError } from '@taquito/core';
2
2
  import BigNumber from 'bignumber.js';
3
3
  /**
4
4
  * @category Error
5
- * @description Error that indicates the metadata not being found on the contract
5
+ * Error that indicates the metadata not being found on the contract
6
6
  */
7
7
  export declare class TokenMetadataNotFound extends TaquitoError {
8
8
  readonly address: string;
@@ -10,7 +10,7 @@ export declare class TokenMetadataNotFound extends TaquitoError {
10
10
  }
11
11
  /**
12
12
  * @category Error
13
- * @description Error that indicates the token ID not being found
13
+ * Error that indicates the token ID not being found
14
14
  */
15
15
  export declare class TokenIdNotFound extends TaquitoError {
16
16
  readonly tokenId: BigNumber;
@@ -18,7 +18,7 @@ export declare class TokenIdNotFound extends TaquitoError {
18
18
  }
19
19
  /**
20
20
  * @category Error
21
- * @description Error that indicates that the token metadata is invalid (not compliant with the TZIP-12 standard)
21
+ * Error that indicates that the token metadata is invalid (not compliant with the TZIP-12 standard)
22
22
  */
23
23
  export declare class InvalidTokenMetadata extends TaquitoError {
24
24
  readonly invalidMetadata: any;
@@ -13,18 +13,18 @@ export declare class Tzip12ContractAbstraction {
13
13
  private _tzip16ContractAbstraction;
14
14
  constructor(contractAbstraction: ContractAbstraction<ContractProvider | Wallet>, context: MetadataContext);
15
15
  /**
16
- * @description Fetches the contract metadata (according to the Tzip-016 standard)
16
+ * Fetches the contract metadata (according to the Tzip-016 standard)
17
17
  * @returns An object containing the metadata, the uri, an optional integrity check result and an optional sha256 hash
18
18
  * or `Undefined` if the contract has no metadata (non-compliant with Tzip-016)
19
19
  */
20
20
  private getContractMetadata;
21
21
  /**
22
- * @description The Tzip-016 "interfaces" field MUST be present in the contract metadata. It should contain "TZIP-012[version-info]"
22
+ * The Tzip-016 "interfaces" field MUST be present in the contract metadata. It should contain "TZIP-012[version-info]"
23
23
  * @returns True if "interfaces" field is present and contains "TZIP-012", false otherwise
24
24
  */
25
25
  isTzip12Compliant(): Promise<boolean>;
26
26
  /**
27
- * @description Fetches the token metadata for a specified token ID.
27
+ * Fetches the token metadata for a specified token ID.
28
28
  * The function first tries to find a `token_metadata` view in the contract metadata and to execute it with the token ID.
29
29
  * If there is no view, the function tries to find a `token_metadata` bigmap in the top-level pairs of the storage.
30
30
  * @param tokenId The ID of the token for which we want to retrieve token metadata
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@taquito/tzip12",
3
- "version": "24.2.0-beta.1",
4
- "description": "Tzip12",
3
+ "version": "24.3.0-beta.0",
4
+ "description": "TZIP-12 token metadata support for Taquito.",
5
5
  "keywords": [
6
+ "taquito",
6
7
  "tezos",
7
- "blockchain",
8
+ "typescript",
8
9
  "tzip12"
9
10
  ],
10
11
  "main": "dist/taquito-tzip12.umd.js",
@@ -17,14 +18,23 @@
17
18
  "publishConfig": {
18
19
  "access": "public"
19
20
  },
20
- "author": "Roxane Letourneau <roxane@ecadlabs.com>",
21
+ "author": "ECAD Labs Inc <info@ecadlabs.com>",
22
+ "contributors": [
23
+ "Roxane Letourneau <roxane@ecadlabs.com>",
24
+ "Davis Sawali <davis.sawali@ecadlabs.com>",
25
+ "Jev Björsell (jevonearth)"
26
+ ],
27
+ "homepage": "https://taquito.io/",
21
28
  "repository": {
22
29
  "type": "git",
23
- "url": ""
30
+ "url": "git+https://github.com/ecadlabs/taquito.git"
31
+ },
32
+ "bugs": {
33
+ "url": "https://github.com/ecadlabs/taquito/issues"
24
34
  },
25
35
  "license": "Apache-2.0",
26
36
  "engines": {
27
- "node": ">=20"
37
+ "node": ">=22"
28
38
  },
29
39
  "scripts": {
30
40
  "lint": "eslint --ext .js,.ts .",
@@ -62,10 +72,10 @@
62
72
  ]
63
73
  },
64
74
  "dependencies": {
65
- "@taquito/core": "^24.2.0-beta.1",
66
- "@taquito/michelson-encoder": "^24.2.0-beta.1",
67
- "@taquito/taquito": "^24.2.0-beta.1",
68
- "@taquito/tzip16": "^24.2.0-beta.1"
75
+ "@taquito/core": "^24.3.0-beta.0",
76
+ "@taquito/michelson-encoder": "^24.3.0-beta.0",
77
+ "@taquito/taquito": "^24.3.0-beta.0",
78
+ "@taquito/tzip16": "^24.3.0-beta.0"
69
79
  },
70
80
  "devDependencies": {
71
81
  "@types/bluebird": "^3.5.42",
@@ -93,7 +103,7 @@
93
103
  "ts-jest": "^29.2.3",
94
104
  "ts-node": "^10.9.2",
95
105
  "ts-toolbelt": "^9.6.0",
96
- "typescript": "~5.5.4"
106
+ "typescript": "^5.9.3"
97
107
  },
98
- "gitHead": "96cefc251b1f16b14f9dedfb2eecda3dbeb2a829"
108
+ "gitHead": "551e35aeff7d6dcde1c72284238c0ed3c3aae77e"
99
109
  }