@alephium/web3 0.38.2 → 0.39.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.
@@ -318,23 +318,26 @@ function calcFieldSize(type, isMutable, structs) {
318
318
  }
319
319
  exports.calcFieldSize = calcFieldSize;
320
320
  function tryDecodeMapDebugLog(message) {
321
- const prefix = '5f5f6d61705f5f'; // __map__
322
- const parts = message.split(',');
323
- if (!message.startsWith(prefix) || parts.length !== 2)
321
+ if (!message.startsWith('insert at map path: ') && !message.startsWith('remove at map path: ')) {
324
322
  return undefined;
325
- if (parts[1] !== 'true' && parts[1] !== 'false')
323
+ }
324
+ const parts = message.split(':');
325
+ if (parts.length !== 2)
326
326
  return undefined;
327
- if (!(0, utils_1.isHexString)(parts[0]))
327
+ const pathString = parts[1].slice(1);
328
+ if (!(0, utils_1.isHexString)(pathString))
328
329
  return undefined;
329
- const remain = parts[0].slice(prefix.length);
330
- const suffixIndex = remain.indexOf('5f5f'); // __
330
+ const prefix = '5f5f6d61705f5f'; // __map__
331
+ const remain = pathString.slice(prefix.length);
332
+ const suffix = '5f5f'; // __
333
+ const suffixIndex = remain.indexOf(suffix);
331
334
  if (suffixIndex === -1)
332
335
  return undefined;
333
336
  const encodedMapIndex = remain.slice(0, suffixIndex);
334
337
  const mapIndex = parseInt(fromAscii(encodedMapIndex));
335
- const encodedKey = (0, utils_1.hexToBinUnsafe)(remain.slice(suffixIndex + 4));
336
- const isInsert = parts[1] === 'true' ? true : false;
337
- return { path: parts[0], mapIndex, encodedKey, isInsert };
338
+ const encodedKey = (0, utils_1.hexToBinUnsafe)(remain.slice(suffixIndex + suffix.length));
339
+ const isInsert = message.startsWith('insert');
340
+ return { path: pathString, mapIndex, encodedKey, isInsert };
338
341
  }
339
342
  exports.tryDecodeMapDebugLog = tryDecodeMapDebugLog;
340
343
  function decodePrimitive(value, type) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alephium/web3",
3
- "version": "0.38.2",
3
+ "version": "0.39.0",
4
4
  "description": "A JS/TS library to interact with the Alephium platform",
5
5
  "license": "GPL",
6
6
  "main": "dist/src/index.js",
@@ -329,21 +329,25 @@ export function calcFieldSize(
329
329
  export function tryDecodeMapDebugLog(
330
330
  message: string
331
331
  ): { path: string; mapIndex: number; encodedKey: Uint8Array; isInsert: boolean } | undefined {
332
- const prefix = '5f5f6d61705f5f' // __map__
333
- const parts = message.split(',')
334
- if (!message.startsWith(prefix) || parts.length !== 2) return undefined
335
- if (parts[1] !== 'true' && parts[1] !== 'false') return undefined
332
+ if (!message.startsWith('insert at map path: ') && !message.startsWith('remove at map path: ')) {
333
+ return undefined
334
+ }
335
+ const parts = message.split(':')
336
+ if (parts.length !== 2) return undefined
337
+ const pathString = parts[1].slice(1)
338
+ if (!isHexString(pathString)) return undefined
336
339
 
337
- if (!isHexString(parts[0])) return undefined
338
- const remain = parts[0].slice(prefix.length)
339
- const suffixIndex = remain.indexOf('5f5f') // __
340
+ const prefix = '5f5f6d61705f5f' // __map__
341
+ const remain = pathString.slice(prefix.length)
342
+ const suffix = '5f5f' // __
343
+ const suffixIndex = remain.indexOf(suffix)
340
344
  if (suffixIndex === -1) return undefined
341
345
 
342
346
  const encodedMapIndex = remain.slice(0, suffixIndex)
343
347
  const mapIndex = parseInt(fromAscii(encodedMapIndex))
344
- const encodedKey = hexToBinUnsafe(remain.slice(suffixIndex + 4))
345
- const isInsert = parts[1] === 'true' ? true : false
346
- return { path: parts[0], mapIndex, encodedKey, isInsert }
348
+ const encodedKey = hexToBinUnsafe(remain.slice(suffixIndex + suffix.length))
349
+ const isInsert = message.startsWith('insert')
350
+ return { path: pathString, mapIndex, encodedKey, isInsert }
347
351
  }
348
352
 
349
353
  export function decodePrimitive(value: Uint8Array, type: string): Val {
@@ -1,3 +1,5 @@
1
+ import "std/fungible_token_interface"
2
+
1
3
  @std(enabled = false)
2
4
  Abstract Contract FungibleTokenUnimplemented() implements IFungibleToken {
3
5
  pub fn getSymbol() -> ByteVec {
@@ -1,3 +1,5 @@
1
+ import "std/nft_interface"
2
+
1
3
  @std(id = #0002)
2
4
  Interface INFTCollection {
3
5
  // Collection Uri points to a json file containing metadata for the NFT collection.
@@ -1,3 +1,5 @@
1
+ import "std/nft_collection_interface"
2
+
1
3
  @std(id = #000201)
2
4
  Interface INFTCollectionWithRoyalty extends INFTCollection {
3
5
  pub fn royaltyAmount(tokenId: ByteVec, salePrice: U256) -> (U256)