From 8d7ad202b9865d6257b0cd18aed7c3d0f966163e Mon Sep 17 00:00:00 2001 From: James Sangalli Date: Mon, 25 May 2020 13:53:57 +1000 Subject: [PATCH] use new syntax on attributes --- .../tokenscript/TokenscriptFunctionTest.java | 42 +++++++++------- app/src/main/assets/xdaicanonicalized.xml | 25 +++++----- .../app/entity/tokenscript/EventUtils.java | 2 +- .../tokenscript/TokenscriptFunction.java | 35 ++++++------- .../app/service/AssetDefinitionService.java | 50 +++++++++---------- .../alphawallet/app/ui/FunctionActivity.java | 14 +++--- .../token/web/AppSiteController.java | 7 ++- .../web/Ethereum/TokenscriptFunction.java | 17 +++---- .../{AttributeType.java => Attribute.java} | 13 +++-- .../token/entity/AttributeInterface.java | 4 +- .../alphawallet/token/entity/TSAction.java | 2 +- .../token/entity/TSTokenViewHolder.java | 2 +- .../token/entity/TransactionResult.java | 2 +- .../token/tools/TokenDefinition.java | 35 +++++++------ .../token/tools/TokenDefinitionTest.java | 2 +- lib/src/test/ts/entrytoken.canonicalized.xml | 30 ++++++----- .../Entity/TokenscriptFunction.java | 17 +++---- .../alphawallet/scripttool/ScriptTool.java | 6 +-- 18 files changed, 161 insertions(+), 144 deletions(-) rename lib/src/main/java/com/alphawallet/token/entity/{AttributeType.java => Attribute.java} (97%) diff --git a/app/src/androidTest/java/com/alphawallet/app/entity/tokenscript/TokenscriptFunctionTest.java b/app/src/androidTest/java/com/alphawallet/app/entity/tokenscript/TokenscriptFunctionTest.java index e85a00ea9..949b85413 100644 --- a/app/src/androidTest/java/com/alphawallet/app/entity/tokenscript/TokenscriptFunctionTest.java +++ b/app/src/androidTest/java/com/alphawallet/app/entity/tokenscript/TokenscriptFunctionTest.java @@ -442,7 +442,8 @@ public class TokenscriptFunctionTest implements ParseResult { " \n" + " \n" + " \n" + - " \n" + + " \n" + + " 1.3.6.1.4.1.1466.115.121.1.15\n" + " \n" + " \n" + " \n" + @@ -451,8 +452,9 @@ public class TokenscriptFunctionTest implements ParseResult { " \n" + " \n" + "\n" + - " \n" + - " \n" + + " \n" + + " \n" + + " 1.3.6.1.4.1.1466.115.121.1.24\n" + " \n" + " Time\n" + " 时间\n" + @@ -460,8 +462,9 @@ public class TokenscriptFunctionTest implements ParseResult { " \n" + " \n" + " \n" + - " \n" + - " \n" + + " \n" + + " \n" + + " 1.3.6.1.4.1.1466.115.121.1.7\n" + " \n" + " \n" + " \n" + @@ -469,8 +472,9 @@ public class TokenscriptFunctionTest implements ParseResult { " \n" + " \n" + " \n" + - " \n" + - " \n" + + " \n" + + " \n" + + " 1.3.6.1.4.1.1466.115.121.1.15\n" + " \n" + " \n" + " \n" + @@ -478,8 +482,9 @@ public class TokenscriptFunctionTest implements ParseResult { " \n" + " \n" + " \n" + - " \n" + - " \n" + + " \n" + + " \n" + + " 1.3.6.1.4.1.1466.115.121.1.15\n" + " \n" + " \n" + " \n" + @@ -487,8 +492,9 @@ public class TokenscriptFunctionTest implements ParseResult { " \n" + " \n" + " \n" + - " \n" + - " \n" + + " \n" + + " \n" + + " 1.3.6.1.4.1.1466.115.121.1.15\n" + " \n" + " \n" + " \n" + @@ -496,7 +502,7 @@ public class TokenscriptFunctionTest implements ParseResult { " \n" + " \n" + " \n" + - " \n" + + " \n" + "\n"; private TokenDefinition entryToken; @@ -511,16 +517,16 @@ public class TokenscriptFunctionTest implements ParseResult { @Test public void attributeTypesShouldExist() { - assertTrue("should have a street attribute", entryToken.attributeTypes.containsKey("street")); - assertTrue("should have a building attribute", entryToken.attributeTypes.containsKey("building")); - assertTrue("should have a state attribute", entryToken.attributeTypes.containsKey("state")); + assertTrue("should have a street attribute", entryToken.attributes.containsKey("street")); + assertTrue("should have a building attribute", entryToken.attributes.containsKey("building")); + assertTrue("should have a state attribute", entryToken.attributes.containsKey("state")); } @Test public void attributeTypesShouldBeUTF8() { - As streetType = entryToken.attributeTypes.get("street").as; - As buildingType = entryToken.attributeTypes.get("building").as; - As stateType = entryToken.attributeTypes.get("state").as; + As streetType = entryToken.attributes.get("street").as; + As buildingType = entryToken.attributes.get("building").as; + As stateType = entryToken.attributes.get("state").as; assertTrue("street, building & state should be a UTF8 origin", streetType.equals(As.UTF8) && buildingType.equals(As.UTF8) && stateType.equals(As.UTF8)); } diff --git a/app/src/main/assets/xdaicanonicalized.xml b/app/src/main/assets/xdaicanonicalized.xml index ab7793c0f..a85c2aef6 100644 --- a/app/src/main/assets/xdaicanonicalized.xml +++ b/app/src/main/assets/xdaicanonicalized.xml @@ -1,9 +1,10 @@ - + Convert to DAI 將xDAI轉爲DAI - + + 1.3.6.1.4.1.1466.115.121.1.36 Amount 代幣金額 @@ -13,7 +14,7 @@ rationale for hardcoding: avoiding over-design --> - + @@ -49,10 +50,10 @@ exclude="low_balance" to the root element. --> - + 0x7301CFA0e1756B71869E93d4e4Dca5c7d0eb0AA6 - - + +