Skip to content

Commit b662542

Browse files
author
Neo
committed
get by address upgrade
1 parent d5b7329 commit b662542

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mixin-node-sdk",
3-
"version": "3.0.28",
3+
"version": "3.0.29",
44
"license": "MIT",
55
"main": "dist/index.js",
66
"typings": "dist/index.d.ts",

src/client/mvm.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,16 +114,17 @@ export const getContractByUserIDs = (ids: string | string[], threshold?: number,
114114
export const getAssetIDByAddress = async (contract_address: string, processAddress = registryAddress): Promise<string> => {
115115
const registry = getRegistryContract(processAddress)
116116
let res = await registry.assets(contract_address)
117-
if (res.isZero()) return ""
118-
res = res._hex.slice(2)
117+
if (res.length <= 2) return ""
118+
res = res.slice(2)
119119
return stringify(Buffer.from(res, 'hex'))
120120
}
121121

122122
export const getUserIDByAddress = async (contract_address: string, processAddress = registryAddress): Promise<string> => {
123123
const registry = getRegistryContract(processAddress)
124124
let res = await registry.users(contract_address)
125-
if (res.isZero()) return ""
126-
res = res._hex.slice(2)
125+
if (res.length <= 2) return ""
126+
res = res.slice(6)
127+
res = res.slice(0, 32)
127128
return stringify(Buffer.from(res, 'hex'))
128129
}
129130

0 commit comments

Comments
 (0)