File tree 3 files changed +20
-4
lines changed
3 files changed +20
-4
lines changed Original file line number Diff line number Diff line change 1
1
manifestVersion : subsquid.io/v0.1
2
2
name : stick
3
- version : 11
3
+ version : 13
4
4
description : ' SubSquid indexer for Uniques and Assets on Statemine'
5
5
build :
6
6
deploy :
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import { getOrFail as get } from '@kodadot1/metasquid/entity'
2
2
import { CollectionEntity , NFTEntity } from '../../model'
3
3
import { unwrap } from '../utils/extract'
4
4
import { Context , isNFT } from '../utils/types'
5
- import { addressOf , unHex } from '../utils/helper'
5
+ import { addressOf , isAddress , unHex } from '../utils/helper'
6
6
import { getAttributeEvent } from './getters'
7
7
import { attributeFrom , tokenIdOf } from './types'
8
8
@@ -37,8 +37,11 @@ export async function handleAttributeSet(context: Context): Promise<void> {
37
37
try {
38
38
final . recipient = final . recipient || addressOf ( event . value as string )
39
39
} catch ( error ) {
40
- console . log ( error )
41
- final . recipient = '' // final.recipient ?? (event.value as string)
40
+ const human = unHex ( event . value )
41
+ final . recipient = isAddress ( human ) ? human : ''
42
+ if ( final . recipient === '' ) {
43
+ console . log ( error )
44
+ }
42
45
}
43
46
}
44
47
Original file line number Diff line number Diff line change @@ -51,6 +51,19 @@ export function addressOf(address: Uint8Array | string): string {
51
51
return ss58 . codec ( codec ) . encode ( value )
52
52
}
53
53
54
+ export function isAddress ( value : Optional < string > ) : value is string {
55
+ if ( ! value ) {
56
+ return false
57
+ }
58
+
59
+ try {
60
+ ss58 . decode ( value )
61
+ return true
62
+ } catch {
63
+ return false
64
+ }
65
+ }
66
+
54
67
/**
55
68
* Decode a hex value
56
69
* @param value - the value to decode
You can’t perform that action at this time.
0 commit comments