(domain, messageTypes, messageData, address)
| 1349 | }; |
| 1350 | } |
| 1351 | starknetEncodeStructuredData(domain, messageTypes, messageData, address) { |
| 1352 | const types = Object.keys(messageTypes); |
| 1353 | if (types.length > 1) { |
| 1354 | throw new NotSupported(this.id + ' starknetEncodeStructuredData only support single type'); |
| 1355 | } |
| 1356 | const request = { |
| 1357 | 'domain': domain, |
| 1358 | 'primaryType': types[0], |
| 1359 | 'types': this.extend({ |
| 1360 | 'StarkNetDomain': [ |
| 1361 | { 'name': 'name', 'type': 'felt' }, |
| 1362 | { 'name': 'chainId', 'type': 'felt' }, |
| 1363 | { 'name': 'version', 'type': 'felt' }, |
| 1364 | ], |
| 1365 | }, messageTypes), |
| 1366 | 'message': messageData, |
| 1367 | }; |
| 1368 | const msgHash = Starknet.typedData.getMessageHash(request, address); |
| 1369 | return msgHash; |
| 1370 | } |
| 1371 | starknetSign(msgHash, pri) { |
| 1372 | // TODO: unify to ecdsa |
| 1373 | const signature = starknetCurveSign(msgHash.replace('0x', ''), pri.replace('0x', '')); |
no test coverage detected