difftreelog
Merge pull request #826 from UniqueNetwork/fix/deprecate-eth-methods
in: master
Deprecate ethereum methods
9 files changed
tests/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"
}
]
tests/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"
},
{
tests/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"
},
{
tests/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",
tests/src/eth/abi/reFungibleToken.jsondiffbeforeafterboth1[2 {3 "anonymous": false,4 "inputs": [5 {6 "indexed": true,7 "internalType": "address",8 "name": "owner",9 "type": "address"10 },11 {12 "indexed": true,13 "internalType": "address",14 "name": "spender",15 "type": "address"16 },17 {18 "indexed": false,19 "internalType": "uint256",20 "name": "value",21 "type": "uint256"22 }23 ],24 "name": "Approval",25 "type": "event"26 },27 {28 "anonymous": false,29 "inputs": [30 {31 "indexed": true,32 "internalType": "address",33 "name": "from",34 "type": "address"35 },36 {37 "indexed": true,38 "internalType": "address",39 "name": "to",40 "type": "address"41 },42 {43 "indexed": false,44 "internalType": "uint256",45 "name": "value",46 "type": "uint256"47 }48 ],49 "name": "Transfer",50 "type": "event"51 },52 {53 "inputs": [54 { "internalType": "address", "name": "owner", "type": "address" },55 { "internalType": "address", "name": "spender", "type": "address" }56 ],57 "name": "allowance",58 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],59 "stateMutability": "view",60 "type": "function"61 },62 {63 "inputs": [64 { "internalType": "address", "name": "spender", "type": "address" },65 { "internalType": "uint256", "name": "amount", "type": "uint256" }66 ],67 "name": "approve",68 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],69 "stateMutability": "nonpayable",70 "type": "function"71 },72 {73 "inputs": [74 {75 "components": [76 { "internalType": "address", "name": "eth", "type": "address" },77 { "internalType": "uint256", "name": "sub", "type": "uint256" }78 ],79 "internalType": "struct CrossAddress",80 "name": "spender",81 "type": "tuple"82 },83 { "internalType": "uint256", "name": "amount", "type": "uint256" }84 ],85 "name": "approveCross",86 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],87 "stateMutability": "nonpayable",88 "type": "function"89 },90 {91 "inputs": [92 { "internalType": "address", "name": "owner", "type": "address" }93 ],94 "name": "balanceOf",95 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],96 "stateMutability": "view",97 "type": "function"98 },99 {100 "inputs": [101 { "internalType": "address", "name": "from", "type": "address" },102 { "internalType": "uint256", "name": "amount", "type": "uint256" }103 ],104 "name": "burnFrom",105 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],106 "stateMutability": "nonpayable",107 "type": "function"108 },109 {110 "inputs": [111 {112 "components": [113 { "internalType": "address", "name": "eth", "type": "address" },114 { "internalType": "uint256", "name": "sub", "type": "uint256" }115 ],116 "internalType": "struct CrossAddress",117 "name": "from",118 "type": "tuple"119 },120 { "internalType": "uint256", "name": "amount", "type": "uint256" }121 ],122 "name": "burnFromCross",123 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],124 "stateMutability": "nonpayable",125 "type": "function"126 },127 {128 "inputs": [],129 "name": "decimals",130 "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }],131 "stateMutability": "view",132 "type": "function"133 },134 {135 "inputs": [],136 "name": "name",137 "outputs": [{ "internalType": "string", "name": "", "type": "string" }],138 "stateMutability": "view",139 "type": "function"140 },141 {142 "inputs": [],143 "name": "parentToken",144 "outputs": [{ "internalType": "address", "name": "", "type": "address" }],145 "stateMutability": "view",146 "type": "function"147 },148 {149 "inputs": [],150 "name": "parentTokenId",151 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],152 "stateMutability": "view",153 "type": "function"154 },155 {156 "inputs": [157 { "internalType": "uint256", "name": "amount", "type": "uint256" }158 ],159 "name": "repartition",160 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],161 "stateMutability": "nonpayable",162 "type": "function"163 },164 {165 "inputs": [166 { "internalType": "bytes4", "name": "interfaceID", "type": "bytes4" }167 ],168 "name": "supportsInterface",169 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],170 "stateMutability": "view",171 "type": "function"172 },173 {174 "inputs": [],175 "name": "symbol",176 "outputs": [{ "internalType": "string", "name": "", "type": "string" }],177 "stateMutability": "view",178 "type": "function"179 },180 {181 "inputs": [],182 "name": "totalSupply",183 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],184 "stateMutability": "view",185 "type": "function"186 },187 {188 "inputs": [189 { "internalType": "address", "name": "to", "type": "address" },190 { "internalType": "uint256", "name": "amount", "type": "uint256" }191 ],192 "name": "transfer",193 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],194 "stateMutability": "nonpayable",195 "type": "function"196 },197 {198 "inputs": [199 {200 "components": [201 { "internalType": "address", "name": "eth", "type": "address" },202 { "internalType": "uint256", "name": "sub", "type": "uint256" }203 ],204 "internalType": "struct CrossAddress",205 "name": "to",206 "type": "tuple"207 },208 { "internalType": "uint256", "name": "amount", "type": "uint256" }209 ],210 "name": "transferCross",211 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],212 "stateMutability": "nonpayable",213 "type": "function"214 },215 {216 "inputs": [217 { "internalType": "address", "name": "from", "type": "address" },218 { "internalType": "address", "name": "to", "type": "address" },219 { "internalType": "uint256", "name": "amount", "type": "uint256" }220 ],221 "name": "transferFrom",222 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],223 "stateMutability": "nonpayable",224 "type": "function"225 },226 {227 "inputs": [228 {229 "components": [230 { "internalType": "address", "name": "eth", "type": "address" },231 { "internalType": "uint256", "name": "sub", "type": "uint256" }232 ],233 "internalType": "struct CrossAddress",234 "name": "from",235 "type": "tuple"236 },237 {238 "components": [239 { "internalType": "address", "name": "eth", "type": "address" },240 { "internalType": "uint256", "name": "sub", "type": "uint256" }241 ],242 "internalType": "struct CrossAddress",243 "name": "to",244 "type": "tuple"245 },246 { "internalType": "uint256", "name": "amount", "type": "uint256" }247 ],248 "name": "transferFromCross",249 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],250 "stateMutability": "nonpayable",251 "type": "function"252 }253]1[2 {3 "anonymous": false,4 "inputs": [5 {6 "indexed": true,7 "internalType": "address",8 "name": "owner",9 "type": "address"10 },11 {12 "indexed": true,13 "internalType": "address",14 "name": "spender",15 "type": "address"16 },17 {18 "indexed": false,19 "internalType": "uint256",20 "name": "value",21 "type": "uint256"22 }23 ],24 "name": "Approval",25 "type": "event"26 },27 {28 "anonymous": false,29 "inputs": [30 {31 "indexed": true,32 "internalType": "address",33 "name": "from",34 "type": "address"35 },36 {37 "indexed": true,38 "internalType": "address",39 "name": "to",40 "type": "address"41 },42 {43 "indexed": false,44 "internalType": "uint256",45 "name": "value",46 "type": "uint256"47 }48 ],49 "name": "Transfer",50 "type": "event"51 },52 {53 "inputs": [54 { "internalType": "address", "name": "owner", "type": "address" },55 { "internalType": "address", "name": "spender", "type": "address" }56 ],57 "name": "allowance",58 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],59 "stateMutability": "view",60 "type": "function"61 },62 {63 "inputs": [64 { "internalType": "address", "name": "spender", "type": "address" },65 { "internalType": "uint256", "name": "amount", "type": "uint256" }66 ],67 "name": "approve",68 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],69 "stateMutability": "nonpayable",70 "type": "function"71 },72 {73 "inputs": [74 {75 "components": [76 { "internalType": "address", "name": "eth", "type": "address" },77 { "internalType": "uint256", "name": "sub", "type": "uint256" }78 ],79 "internalType": "struct CrossAddress",80 "name": "spender",81 "type": "tuple"82 },83 { "internalType": "uint256", "name": "amount", "type": "uint256" }84 ],85 "name": "approveCross",86 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],87 "stateMutability": "nonpayable",88 "type": "function"89 },90 {91 "inputs": [92 { "internalType": "address", "name": "owner", "type": "address" }93 ],94 "name": "balanceOf",95 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],96 "stateMutability": "view",97 "type": "function"98 },99 {100 "inputs": [101 {102 "components": [103 { "internalType": "address", "name": "eth", "type": "address" },104 { "internalType": "uint256", "name": "sub", "type": "uint256" }105 ],106 "internalType": "struct CrossAddress",107 "name": "from",108 "type": "tuple"109 },110 { "internalType": "uint256", "name": "amount", "type": "uint256" }111 ],112 "name": "burnFromCross",113 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],114 "stateMutability": "nonpayable",115 "type": "function"116 },117 {118 "inputs": [],119 "name": "decimals",120 "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }],121 "stateMutability": "view",122 "type": "function"123 },124 {125 "inputs": [],126 "name": "name",127 "outputs": [{ "internalType": "string", "name": "", "type": "string" }],128 "stateMutability": "view",129 "type": "function"130 },131 {132 "inputs": [],133 "name": "parentToken",134 "outputs": [{ "internalType": "address", "name": "", "type": "address" }],135 "stateMutability": "view",136 "type": "function"137 },138 {139 "inputs": [],140 "name": "parentTokenId",141 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],142 "stateMutability": "view",143 "type": "function"144 },145 {146 "inputs": [147 { "internalType": "uint256", "name": "amount", "type": "uint256" }148 ],149 "name": "repartition",150 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],151 "stateMutability": "nonpayable",152 "type": "function"153 },154 {155 "inputs": [156 { "internalType": "bytes4", "name": "interfaceID", "type": "bytes4" }157 ],158 "name": "supportsInterface",159 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],160 "stateMutability": "view",161 "type": "function"162 },163 {164 "inputs": [],165 "name": "symbol",166 "outputs": [{ "internalType": "string", "name": "", "type": "string" }],167 "stateMutability": "view",168 "type": "function"169 },170 {171 "inputs": [],172 "name": "totalSupply",173 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],174 "stateMutability": "view",175 "type": "function"176 },177 {178 "inputs": [179 { "internalType": "address", "name": "to", "type": "address" },180 { "internalType": "uint256", "name": "amount", "type": "uint256" }181 ],182 "name": "transfer",183 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],184 "stateMutability": "nonpayable",185 "type": "function"186 },187 {188 "inputs": [189 {190 "components": [191 { "internalType": "address", "name": "eth", "type": "address" },192 { "internalType": "uint256", "name": "sub", "type": "uint256" }193 ],194 "internalType": "struct CrossAddress",195 "name": "to",196 "type": "tuple"197 },198 { "internalType": "uint256", "name": "amount", "type": "uint256" }199 ],200 "name": "transferCross",201 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],202 "stateMutability": "nonpayable",203 "type": "function"204 },205 {206 "inputs": [207 { "internalType": "address", "name": "from", "type": "address" },208 { "internalType": "address", "name": "to", "type": "address" },209 { "internalType": "uint256", "name": "amount", "type": "uint256" }210 ],211 "name": "transferFrom",212 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],213 "stateMutability": "nonpayable",214 "type": "function"215 },216 {217 "inputs": [218 {219 "components": [220 { "internalType": "address", "name": "eth", "type": "address" },221 { "internalType": "uint256", "name": "sub", "type": "uint256" }222 ],223 "internalType": "struct CrossAddress",224 "name": "from",225 "type": "tuple"226 },227 {228 "components": [229 { "internalType": "address", "name": "eth", "type": "address" },230 { "internalType": "uint256", "name": "sub", "type": "uint256" }231 ],232 "internalType": "struct CrossAddress",233 "name": "to",234 "type": "tuple"235 },236 { "internalType": "uint256", "name": "amount", "type": "uint256" }237 ],238 "name": "transferFromCross",239 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],240 "stateMutability": "nonpayable",241 "type": "function"242 }243]tests/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"
+ }
+]
tests/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});
tests/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();
tests/src/eth/util/playgrounds/unique.dev.tsdiffbeforeafterboth--- a/tests/src/eth/util/playgrounds/unique.dev.ts
+++ b/tests/src/eth/util/playgrounds/unique.dev.ts
@@ -29,6 +29,7 @@
import refungibleAbi from '../../abi/reFungible.json';
import refungibleDeprecatedAbi from '../../abi/reFungibleDeprecated.json';
import refungibleTokenAbi from '../../abi/reFungibleToken.json';
+import refungibleTokenDeprecatedAbi from '../../abi/reFungibleTokenDeprecated.json';
import contractHelpersAbi from '../../abi/contractHelpers.json';
import {ICrossAccountId, TEthereumAccount} from '../../../util/playgrounds/types';
import {TCollectionMode} from '../../../util/playgrounds/types';
@@ -187,17 +188,18 @@
return this.collection(this.helper.ethAddress.fromCollectionId(collectionId), mode, caller, mergeDeprecated);
}
- async rftToken(address: string, caller?: string) {
+ async rftToken(address: string, caller?: string, mergeDeprecated = false) {
const web3 = this.helper.getWeb3();
- return unlimitedMoneyHack(new web3.eth.Contract(refungibleTokenAbi as any, address, {
+ const abi = mergeDeprecated ? [...refungibleTokenAbi, ...refungibleTokenDeprecatedAbi] : refungibleTokenAbi;
+ return unlimitedMoneyHack(new web3.eth.Contract(abi as any, address, {
gas: this.helper.eth.DEFAULT_GAS,
gasPrice: await this.getGasPrice(),
...(caller ? {from: caller} : {}),
}));
}
- rftTokenById(collectionId: number, tokenId: number, caller?: string) {
- return this.rftToken(this.helper.ethAddress.fromTokenId(collectionId, tokenId), caller);
+ rftTokenById(collectionId: number, tokenId: number, caller?: string, mergeDeprecated = false) {
+ return this.rftToken(this.helper.ethAddress.fromTokenId(collectionId, tokenId), caller, mergeDeprecated);
}
}