()
| 468 | } |
| 469 | |
| 470 | async getProps(){ |
| 471 | let basicProps = {}; |
| 472 | try { |
| 473 | ethersData = await getEthersData(); |
| 474 | |
| 475 | const attributeXmlNodes = this.xmlDoc.evaluate('ts:attribute', this.tokenXMLNode, this.nsResolver, XPathResult.ANY_TYPE, null ); |
| 476 | |
| 477 | |
| 478 | let attributeNode; |
| 479 | |
| 480 | while (attributeXmlNodes && (attributeNode = attributeXmlNodes.iterateNext() ) ) { |
| 481 | let name = attributeNode.getAttribute('name'); |
| 482 | let originsInnerNode = getXMLItem(this.xmlDoc ,'ts:origins/*[1]',attributeNode); |
| 483 | if (!originsInnerNode) continue; |
| 484 | |
| 485 | let dataNodeName = originsInnerNode.nodeName; |
| 486 | let res; |
| 487 | |
| 488 | // this.debug && console.log(dataNodeName); |
| 489 | |
| 490 | switch (dataNodeName) { |
| 491 | case 'ts:token-id': |
| 492 | // res = "542b33000000000000000000000001075b2282"; |
| 493 | res = this.tokenID; |
| 494 | |
| 495 | this.debug && console.log('its ts:token-id, just use tokenID '); |
| 496 | break; |
| 497 | case "ethereum:call": |
| 498 | // this.debug && console.log('its ethereum call start'); |
| 499 | let { |
| 500 | params, |
| 501 | ethCallAttributtes, |
| 502 | contract, |
| 503 | missedAttribute |
| 504 | } = getEthereumCallParams({ |
| 505 | userAddress: this.ethersData.userAddress, |
| 506 | chainID: this.ethersData.chainID, |
| 507 | ethereumNode: originsInnerNode, |
| 508 | xmlDoc: this.xmlDoc, |
| 509 | tokenXmlNode: this.tokenXMLNode, |
| 510 | tokenName: this.tokenName, |
| 511 | tokenId: this.tokenID, |
| 512 | debug: this.debug, |
| 513 | }); |
| 514 | |
| 515 | if ( (!ethCallAttributtes || !ethCallAttributtes.contract) && (!contract || !contract.contractAddress) ) throw new Error(' ethContract and contractAddress required for {Address='+this.ethersData.userAddress+', chainID = '+this.ethersData.chainID+' , tokenName = '+this.tokenName+'}. Check logs for details'); |
| 516 | |
| 517 | if (missedAttribute) { |
| 518 | this.debug && console.log('missed attribute: "' + missedAttribute + '", ethereum call skipped'); |
| 519 | break; |
| 520 | } |
| 521 | |
| 522 | const [abi_error, abi] = await to( getJSONAbi(ethCallAttributtes.contract,jsons,config.contractJsonPath, tsDebug ) ); |
| 523 | |
| 524 | if (!abi) { |
| 525 | console.error('Cant get Contract ABI for "'+ ethCallAttributtes.contract +'" , attribute "' + name + '" skipped'); |
| 526 | throw new Error('Empty ABI for '+ethCallAttributtes.contract); |
| 527 | } |
no test coverage detected