zetrix-connect-wallet-sdk-test 1.0.2 → 1.0.4
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/lib/index.js +43 -15
- package/package.json +1 -1
package/lib/index.js
CHANGED
@@ -209,34 +209,62 @@ class ZetrixWalletConnect {
|
|
209
209
|
return this.zetrixWebView.authAndSignMessage(param)
|
210
210
|
} else {
|
211
211
|
return new Promise((resolve, reject) => {
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
212
|
+
let obj = {
|
213
|
+
linkTo: 'H5_' + sdkType.bindAndSignMessage,
|
214
|
+
type: 'H5_' + sdkType.bindAndSignMessage,
|
215
|
+
host: getWindowUrl(),
|
216
|
+
icon: getWindowICO(),
|
217
|
+
sessionId: createSessionId(),
|
218
|
+
source: isMobile() ? typeInfo.mobileSource : '',
|
219
|
+
message: param.message
|
220
|
+
}
|
221
|
+
|
222
|
+
this.walletSocket.h5Bind({
|
223
|
+
type: obj.type,
|
224
|
+
sessionId: obj.sessionId,
|
225
|
+
source: obj.source
|
226
|
+
}).then(res => {
|
227
|
+
closeQr()
|
228
|
+
if (res.code === 0) {
|
229
|
+
setAuthData(res.sessionId, res.data.address)
|
230
|
+
} else {
|
231
|
+
reject({
|
232
|
+
code: res.code,
|
233
|
+
message: res.message
|
234
|
+
})
|
224
235
|
}
|
236
|
+
|
225
237
|
this.signMessage(param).then(signRes => {
|
226
238
|
resolve({
|
227
239
|
code: 0,
|
228
240
|
data: {
|
241
|
+
sessionId: res.sessionId,
|
229
242
|
address: signRes.data.address,
|
230
243
|
publicKey: signRes.data.publicKey,
|
231
244
|
signData: signRes.data.signData
|
232
245
|
}
|
233
246
|
})
|
234
247
|
}).catch(signError => {
|
235
|
-
reject(
|
248
|
+
reject({
|
249
|
+
code: signError.code,
|
250
|
+
message: signError.message
|
251
|
+
})
|
252
|
+
})
|
253
|
+
}).catch(error => {
|
254
|
+
closeQr()
|
255
|
+
reject({
|
256
|
+
code: errorCode,
|
257
|
+
message: systemErrorInfo.abnormalOperation
|
236
258
|
})
|
237
|
-
}).catch(authError => {
|
238
|
-
reject(authError)
|
239
259
|
})
|
260
|
+
|
261
|
+
if (this.isQrcode) {
|
262
|
+
this.authQr(obj).then(res => {
|
263
|
+
resolve(res)
|
264
|
+
})
|
265
|
+
} else {
|
266
|
+
this.linkTo.createHostParam(obj)
|
267
|
+
}
|
240
268
|
})
|
241
269
|
}
|
242
270
|
}
|
package/package.json
CHANGED