git.delta.rocks / unique-network / refs/commits / 46515fa1c836

difftreelog

Merge pull request #826 from UniqueNetwork/fix/deprecate-eth-methods

ut-akuznetsov2023-01-12parents: #6994f61 #766b8da.patch.diff
in: master
Deprecate ethereum methods

9 files changed

modifiedtests/src/eth/abi/fungibleDeprecated.jsondiffbeforeafterboth
--- a/tests/src/eth/abi/fungibleDeprecated.json
+++ b/tests/src/eth/abi/fungibleDeprecated.json
@@ -88,14 +88,5 @@
     "outputs": [],
     "stateMutability": "nonpayable",
     "type": "function"
-  },
-  {
-    "inputs": [
-      { "internalType": "address", "name": "newOwner", "type": "address" }
-    ],
-    "name": "changeCollectionOwner",
-    "outputs": [],
-    "stateMutability": "nonpayable",
-    "type": "function"
   }
 ]
modifiedtests/src/eth/abi/nonFungible.jsondiffbeforeafterboth
--- a/tests/src/eth/abi/nonFungible.json
+++ b/tests/src/eth/abi/nonFungible.json
@@ -51,12 +51,6 @@
   },
   {
     "anonymous": false,
-    "inputs": [],
-    "name": "MintingFinished",
-    "type": "event"
-  },
-  {
-    "anonymous": false,
     "inputs": [
       {
         "indexed": true,
@@ -420,13 +414,6 @@
     "name": "description",
     "outputs": [{ "internalType": "string", "name": "", "type": "string" }],
     "stateMutability": "view",
-    "type": "function"
-  },
-  {
-    "inputs": [],
-    "name": "finishMinting",
-    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
-    "stateMutability": "nonpayable",
     "type": "function"
   },
   {
@@ -513,13 +500,6 @@
     "name": "mintWithTokenURI",
     "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
     "stateMutability": "nonpayable",
-    "type": "function"
-  },
-  {
-    "inputs": [],
-    "name": "mintingFinished",
-    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
-    "stateMutability": "view",
     "type": "function"
   },
   {
modifiedtests/src/eth/abi/reFungible.jsondiffbeforeafterboth
--- a/tests/src/eth/abi/reFungible.json
+++ b/tests/src/eth/abi/reFungible.json
@@ -51,12 +51,6 @@
   },
   {
     "anonymous": false,
-    "inputs": [],
-    "name": "MintingFinished",
-    "type": "event"
-  },
-  {
-    "anonymous": false,
     "inputs": [
       {
         "indexed": true,
@@ -402,13 +396,6 @@
     "name": "description",
     "outputs": [{ "internalType": "string", "name": "", "type": "string" }],
     "stateMutability": "view",
-    "type": "function"
-  },
-  {
-    "inputs": [],
-    "name": "finishMinting",
-    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
-    "stateMutability": "nonpayable",
     "type": "function"
   },
   {
@@ -495,13 +482,6 @@
     "name": "mintWithTokenURI",
     "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
     "stateMutability": "nonpayable",
-    "type": "function"
-  },
-  {
-    "inputs": [],
-    "name": "mintingFinished",
-    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
-    "stateMutability": "view",
     "type": "function"
   },
   {
modifiedtests/src/eth/abi/reFungibleDeprecated.jsondiffbeforeafterboth
--- a/tests/src/eth/abi/reFungibleDeprecated.json
+++ b/tests/src/eth/abi/reFungibleDeprecated.json
@@ -82,6 +82,17 @@
   },
   {
     "inputs": [
+      { "internalType": "uint256", "name": "tokenId", "type": "uint256" },
+      { "internalType": "string", "name": "key", "type": "string" },
+      { "internalType": "bytes", "name": "value", "type": "bytes" }
+    ],
+    "name": "setProperty",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
       { "internalType": "address", "name": "newOwner", "type": "address" }
     ],
     "name": "changeCollectionOwner",
modifiedtests/src/eth/abi/reFungibleToken.jsondiffbeforeafterboth
--- a/tests/src/eth/abi/reFungibleToken.json
+++ b/tests/src/eth/abi/reFungibleToken.json
@@ -98,16 +98,6 @@
   },
   {
     "inputs": [
-      { "internalType": "address", "name": "from", "type": "address" },
-      { "internalType": "uint256", "name": "amount", "type": "uint256" }
-    ],
-    "name": "burnFrom",
-    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
-    "stateMutability": "nonpayable",
-    "type": "function"
-  },
-  {
-    "inputs": [
       {
         "components": [
           { "internalType": "address", "name": "eth", "type": "address" },
addedtests/src/eth/abi/reFungibleTokenDeprecated.jsondiffbeforeafterboth
--- /dev/null
+++ b/tests/src/eth/abi/reFungibleTokenDeprecated.json
@@ -0,0 +1,12 @@
+[
+  {
+    "inputs": [
+      { "internalType": "address", "name": "from", "type": "address" },
+      { "internalType": "uint256", "name": "amount", "type": "uint256" }
+    ],
+    "name": "burnFrom",
+    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  }
+]
modifiedtests/src/eth/reFungible.test.tsdiffbeforeafterboth
--- a/tests/src/eth/reFungible.test.ts
+++ b/tests/src/eth/reFungible.test.ts
@@ -74,7 +74,7 @@
 
     const result = await contract.methods.mint(caller).send();
     const tokenId = result.events.Transfer.returnValues.tokenId;
-    const tokenContract = await helper.ethNativeContract.rftTokenById(collectionId, tokenId, caller);
+    const tokenContract = await helper.ethNativeContract.rftTokenById(collectionId, tokenId, caller, true);
 
     await tokenContract.methods.repartition(2).send();
     await tokenContract.methods.transfer(receiver, 1).send();
@@ -316,7 +316,7 @@
     const address = helper.ethAddress.fromCollectionId(collection.collectionId);
     const contract = await helper.ethNativeContract.collection(address, 'rft');
 
-    const rftToken = await helper.ethNativeContract.rftTokenById(token.collectionId, token.tokenId, owner);
+    const rftToken = await helper.ethNativeContract.rftTokenById(token.collectionId, token.tokenId, owner, true);
 
     {
       await rftToken.methods.approve(operator, 15n).send({from: owner});
modifiedtests/src/eth/reFungibleToken.test.tsdiffbeforeafterboth
--- a/tests/src/eth/reFungibleToken.test.ts
+++ b/tests/src/eth/reFungibleToken.test.ts
@@ -458,7 +458,7 @@
     const result = await contract.methods.mint(caller).send();
     const tokenId = result.events.Transfer.returnValues.tokenId;
     const tokenAddress = helper.ethAddress.fromTokenId(collectionId, tokenId);
-    const tokenContract = await helper.ethNativeContract.rftToken(tokenAddress, caller);
+    const tokenContract = await helper.ethNativeContract.rftToken(tokenAddress, caller, true);
 
     await tokenContract.methods.repartition(2).send();
     await tokenContract.methods.transfer(receiver, 1).send();
modifiedtests/src/eth/util/playgrounds/unique.dev.tsdiffbeforeafterboth
29import refungibleAbi from '../../abi/reFungible.json';29import refungibleAbi from '../../abi/reFungible.json';
30import refungibleDeprecatedAbi from '../../abi/reFungibleDeprecated.json';30import refungibleDeprecatedAbi from '../../abi/reFungibleDeprecated.json';
31import refungibleTokenAbi from '../../abi/reFungibleToken.json';31import refungibleTokenAbi from '../../abi/reFungibleToken.json';
32import refungibleTokenDeprecatedAbi from '../../abi/reFungibleTokenDeprecated.json';
32import contractHelpersAbi from '../../abi/contractHelpers.json';33import contractHelpersAbi from '../../abi/contractHelpers.json';
33import {ICrossAccountId, TEthereumAccount} from '../../../util/playgrounds/types';34import {ICrossAccountId, TEthereumAccount} from '../../../util/playgrounds/types';
34import {TCollectionMode} from '../../../util/playgrounds/types';35import {TCollectionMode} from '../../../util/playgrounds/types';
187 return this.collection(this.helper.ethAddress.fromCollectionId(collectionId), mode, caller, mergeDeprecated);188 return this.collection(this.helper.ethAddress.fromCollectionId(collectionId), mode, caller, mergeDeprecated);
188 }189 }
189190
190 async rftToken(address: string, caller?: string) {191 async rftToken(address: string, caller?: string, mergeDeprecated = false) {
191 const web3 = this.helper.getWeb3();192 const web3 = this.helper.getWeb3();
193 const abi = mergeDeprecated ? [...refungibleTokenAbi, ...refungibleTokenDeprecatedAbi] : refungibleTokenAbi;
192 return unlimitedMoneyHack(new web3.eth.Contract(refungibleTokenAbi as any, address, {194 return unlimitedMoneyHack(new web3.eth.Contract(abi as any, address, {
193 gas: this.helper.eth.DEFAULT_GAS,195 gas: this.helper.eth.DEFAULT_GAS,
194 gasPrice: await this.getGasPrice(),196 gasPrice: await this.getGasPrice(),
195 ...(caller ? {from: caller} : {}),197 ...(caller ? {from: caller} : {}),
196 }));198 }));
197 }199 }
198200
199 rftTokenById(collectionId: number, tokenId: number, caller?: string) {201 rftTokenById(collectionId: number, tokenId: number, caller?: string, mergeDeprecated = false) {
200 return this.rftToken(this.helper.ethAddress.fromTokenId(collectionId, tokenId), caller);202 return this.rftToken(this.helper.ethAddress.fromTokenId(collectionId, tokenId), caller, mergeDeprecated);
201 }203 }
202}204}
203205