@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.
- package/dist/alephium-web3.min.js +1 -1
- package/dist/alephium-web3.min.js.map +1 -1
- package/dist/src/contract/ralph.js +13 -10
- package/package.json +1 -1
- package/src/contract/ralph.ts +14 -10
- package/std/fungible_token_unimplemented.ral +2 -0
- package/std/nft_collection_interface.ral +2 -0
- package/std/nft_collection_with_royalty_interface.ral +2 -0
|
@@ -318,23 +318,26 @@ function calcFieldSize(type, isMutable, structs) {
|
|
|
318
318
|
}
|
|
319
319
|
exports.calcFieldSize = calcFieldSize;
|
|
320
320
|
function tryDecodeMapDebugLog(message) {
|
|
321
|
-
|
|
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
|
-
|
|
323
|
+
}
|
|
324
|
+
const parts = message.split(':');
|
|
325
|
+
if (parts.length !== 2)
|
|
326
326
|
return undefined;
|
|
327
|
-
|
|
327
|
+
const pathString = parts[1].slice(1);
|
|
328
|
+
if (!(0, utils_1.isHexString)(pathString))
|
|
328
329
|
return undefined;
|
|
329
|
-
const
|
|
330
|
-
const
|
|
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 +
|
|
336
|
-
const isInsert =
|
|
337
|
-
return { path:
|
|
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
package/src/contract/ralph.ts
CHANGED
|
@@ -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
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
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
|
-
|
|
338
|
-
const remain =
|
|
339
|
-
const
|
|
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 +
|
|
345
|
-
const isInsert =
|
|
346
|
-
return { path:
|
|
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 {
|