diff --git a/src/abis/abiGameMall.ts b/src/abis/abiGameMall.ts new file mode 100644 index 0000000..2aa7d9a --- /dev/null +++ b/src/abis/abiGameMall.ts @@ -0,0 +1,388 @@ +import { AbiItem } from "web3-utils"; + +export let abiGameMall: AbiItem[] = [ + { + inputs: [], + stateMutability: "nonpayable", + type: "constructor", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "erc20", + type: "address", + }, + ], + name: "AddERC20Suppout", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "buyer", + type: "address", + }, + { + indexed: true, + internalType: "uint256", + name: "orderId", + type: "uint256", + }, + { + indexed: false, + internalType: "address", + name: "currency", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "price", + type: "uint256", + }, + ], + name: "ItemSoldOut", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "previousOwner", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "newOwner", + type: "address", + }, + ], + name: "OwnershipTransferred", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "erc20", + type: "address", + }, + ], + name: "RemoveERC20Suppout", + type: "event", + }, + { + inputs: [ + { + internalType: "address", + name: "erc20", + type: "address", + }, + ], + name: "addERC20Support", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "signer", + type: "address", + }, + { + internalType: "bytes32", + name: "hash", + type: "bytes32", + }, + { + internalType: "bytes", + name: "signature", + type: "bytes", + }, + ], + name: "checkSigner", + outputs: [], + stateMutability: "pure", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "signer", + type: "address", + }, + { + internalType: "bytes32", + name: "structHash", + type: "bytes32", + }, + { + internalType: "bytes", + name: "signature", + type: "bytes", + }, + ], + name: "checkSigner712", + outputs: [], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + name: "erc20Supported", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "executor", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "feeToAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "getDuration", + outputs: [ + { + internalType: "uint256", + name: "duration", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + name: "orderIdUsed", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "owner", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "erc20", + type: "address", + }, + ], + name: "removeERC20Support", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "renounceOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_feeToAddress", + type: "address", + }, + ], + name: "setFeeToAddress", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "newOwner", + type: "address", + }, + ], + name: "transferOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "valNew", + type: "uint256", + }, + ], + name: "updateDuation", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address", + }, + ], + name: "updateExecutor", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "orderId", + type: "uint256", + }, + { + internalType: "address", + name: "currency", + type: "address", + }, + { + internalType: "uint256", + name: "price", + type: "uint256", + }, + { + internalType: "uint256", + name: "startTime", + type: "uint256", + }, + { + internalType: "uint256", + name: "saltNonce", + type: "uint256", + }, + { + internalType: "bytes", + name: "signature", + type: "bytes", + }, + ], + name: "buy", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_buyer", + type: "address", + }, + { + internalType: "uint256", + name: "_orderId", + type: "uint256", + }, + { + internalType: "address", + name: "_currency", + type: "address", + }, + { + internalType: "uint256", + name: "_price", + type: "uint256", + }, + { + internalType: "uint256", + name: "_startTime", + type: "uint256", + }, + { + internalType: "uint256", + name: "_saltNonce", + type: "uint256", + }, + ], + name: "getMessageHash", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + stateMutability: "pure", + type: "function", + }, +]; diff --git a/src/abis/abiGameMarket.ts b/src/abis/abiGameMarket.ts new file mode 100644 index 0000000..332ea2e --- /dev/null +++ b/src/abis/abiGameMarket.ts @@ -0,0 +1,461 @@ +import { AbiItem } from "web3-utils"; + +export let abiGameMarket: AbiItem[] = [ + { + inputs: [], + stateMutability: "nonpayable", + type: "constructor", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "erc20", + type: "address", + }, + ], + name: "AddERC20Suppout", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "buyer", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "seller", + type: "address", + }, + { + indexed: true, + internalType: "uint256", + name: "orderId", + type: "uint256", + }, + { + indexed: false, + internalType: "address", + name: "currency", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "price", + type: "uint256", + }, + ], + name: "ItemSoldOut", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "previousOwner", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "newOwner", + type: "address", + }, + ], + name: "OwnershipTransferred", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "erc20", + type: "address", + }, + ], + name: "RemoveERC20Suppout", + type: "event", + }, + { + inputs: [], + name: "MAX_TRANSACTION_FEE", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "MIN_TRANSACTION_FEE", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "erc20", + type: "address", + }, + ], + name: "addERC20Support", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "signer", + type: "address", + }, + { + internalType: "bytes32", + name: "hash", + type: "bytes32", + }, + { + internalType: "bytes", + name: "signature", + type: "bytes", + }, + ], + name: "checkSigner", + outputs: [], + stateMutability: "pure", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "signer", + type: "address", + }, + { + internalType: "bytes32", + name: "structHash", + type: "bytes32", + }, + { + internalType: "bytes", + name: "signature", + type: "bytes", + }, + ], + name: "checkSigner712", + outputs: [], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + name: "erc20Supported", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "executor", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "feeToAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "getDuration", + outputs: [ + { + internalType: "uint256", + name: "duration", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + name: "orderIdUsed", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "owner", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "erc20", + type: "address", + }, + ], + name: "removeERC20Support", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "renounceOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_feeToAddress", + type: "address", + }, + ], + name: "setFeeToAddress", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "transactionFee", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "newOwner", + type: "address", + }, + ], + name: "transferOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "valNew", + type: "uint256", + }, + ], + name: "updateDuation", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address", + }, + ], + name: "updateExecutor", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "orderId", + type: "uint256", + }, + { + internalType: "address", + name: "seller", + type: "address", + }, + { + internalType: "address", + name: "currency", + type: "address", + }, + { + internalType: "uint256", + name: "price", + type: "uint256", + }, + { + internalType: "uint256", + name: "startTime", + type: "uint256", + }, + { + internalType: "uint256", + name: "saltNonce", + type: "uint256", + }, + { + internalType: "bytes", + name: "signature", + type: "bytes", + }, + ], + name: "buy", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "_transactionFee", + type: "uint256", + }, + ], + name: "setTransactionFee", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_buyer", + type: "address", + }, + { + internalType: "address", + name: "_seller", + type: "address", + }, + { + internalType: "uint256", + name: "_orderId", + type: "uint256", + }, + { + internalType: "address", + name: "_currency", + type: "address", + }, + { + internalType: "uint256", + name: "_price", + type: "uint256", + }, + { + internalType: "address", + name: "_feeToAddress", + type: "address", + }, + { + internalType: "uint256", + name: "_startTime", + type: "uint256", + }, + { + internalType: "uint256", + name: "_saltNonce", + type: "uint256", + }, + ], + name: "getMessageHash", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + stateMutability: "pure", + type: "function", + }, +]; diff --git a/src/abis/abiMall.ts b/src/abis/abiMall.ts new file mode 100644 index 0000000..91cae05 --- /dev/null +++ b/src/abis/abiMall.ts @@ -0,0 +1,418 @@ +import { AbiItem } from "web3-utils"; + +export let abiMall: AbiItem[] = [ + { + inputs: [], + stateMutability: "nonpayable", + type: "constructor", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "erc20", + type: "address", + }, + ], + name: "AddERC20Suppout", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "buyer", + type: "address", + }, + { + indexed: true, + internalType: "uint256", + name: "nonce", + type: "uint256", + }, + { + indexed: false, + internalType: "uint256", + name: "tokenId", + type: "uint256", + }, + { + indexed: false, + internalType: "address[3]", + name: "addresses", + type: "address[3]", + }, + { + indexed: false, + internalType: "uint256", + name: "price", + type: "uint256", + }, + ], + name: "BuyTransaction", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "previousOwner", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "newOwner", + type: "address", + }, + ], + name: "OwnershipTransferred", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "erc20", + type: "address", + }, + ], + name: "RemoveERC20Suppout", + type: "event", + }, + { + inputs: [ + { + internalType: "address", + name: "erc20", + type: "address", + }, + ], + name: "addERC20Support", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "signer", + type: "address", + }, + { + internalType: "bytes32", + name: "hash", + type: "bytes32", + }, + { + internalType: "bytes", + name: "signature", + type: "bytes", + }, + ], + name: "checkSigner", + outputs: [], + stateMutability: "pure", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "signer", + type: "address", + }, + { + internalType: "bytes32", + name: "structHash", + type: "bytes32", + }, + { + internalType: "bytes", + name: "signature", + type: "bytes", + }, + ], + name: "checkSigner712", + outputs: [], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + name: "erc20Supported", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "executor", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "feeToAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "getDuration", + outputs: [ + { + internalType: "uint256", + name: "duration", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + name: "nftTokenSupported", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "owner", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "erc20", + type: "address", + }, + ], + name: "removeERC20Support", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "renounceOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_feeToAddress", + type: "address", + }, + ], + name: "setFeeToAddress", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "newOwner", + type: "address", + }, + ], + name: "transferOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "valNew", + type: "uint256", + }, + ], + name: "updateDuation", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address", + }, + ], + name: "updateExecutor", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "nftToken", + type: "address", + }, + ], + name: "addNFTTokenSupport", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "nftToken", + type: "address", + }, + ], + name: "removeNFTTokenSupport", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address[4]", + name: "addresses", + type: "address[4]", + }, + { + internalType: "uint256[]", + name: "signArray", + type: "uint256[]", + }, + { + internalType: "bytes", + name: "signature", + type: "bytes", + }, + ], + name: "ignoreSignature", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address[3]", + name: "addresses", + type: "address[3]", + }, + { + internalType: "uint256[4]", + name: "values", + type: "uint256[4]", + }, + { + internalType: "bytes", + name: "signature", + type: "bytes", + }, + ], + name: "buyNFT", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_nftAddress", + type: "address", + }, + { + internalType: "address", + name: "_tokenAddress", + type: "address", + }, + { + internalType: "address", + name: "_buyerAddress", + type: "address", + }, + { + internalType: "uint256[]", + name: "_datas", + type: "uint256[]", + }, + ], + name: "getMessageHash", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + stateMutability: "pure", + type: "function", + }, +]; diff --git a/src/abis/abiMarket.ts b/src/abis/abiMarket.ts new file mode 100644 index 0000000..2b4f9ce --- /dev/null +++ b/src/abis/abiMarket.ts @@ -0,0 +1,935 @@ +import { AbiItem } from "web3-utils"; + +export let abiMarket: AbiItem[] = [ + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "erc20", + type: "address", + }, + ], + name: "AddERC20Suppout", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "nftToken", + type: "address", + }, + ], + name: "AddNFTSuppout", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "tokenId", + type: "uint256", + }, + { + indexed: false, + internalType: "uint256", + name: "orderId", + type: "uint256", + }, + { + indexed: false, + internalType: "address", + name: "nftToken", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "amount", + type: "uint256", + }, + { + indexed: false, + internalType: "address", + name: "seller", + type: "address", + }, + { + indexed: false, + internalType: "address", + name: "buyer", + type: "address", + }, + { + indexed: false, + internalType: "address", + name: "erc20", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "price", + type: "uint256", + }, + ], + name: "BuyOrder", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "orderId", + type: "uint256", + }, + { + indexed: true, + internalType: "address", + name: "nftToken", + type: "address", + }, + { + indexed: true, + internalType: "uint256", + name: "tokenId", + type: "uint256", + }, + ], + name: "CancelOrder", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "previousOwner", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "newOwner", + type: "address", + }, + ], + name: "OwnershipTransferred", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "orderId", + type: "uint256", + }, + { + indexed: true, + internalType: "address", + name: "nftToken", + type: "address", + }, + { + indexed: true, + internalType: "uint256", + name: "tokenId", + type: "uint256", + }, + { + indexed: false, + internalType: "uint256", + name: "priceOld", + type: "uint256", + }, + { + indexed: false, + internalType: "uint256", + name: "price", + type: "uint256", + }, + ], + name: "PriceUpdate", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "erc20", + type: "address", + }, + ], + name: "RemoveERC20Suppout", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "nftToken", + type: "address", + }, + ], + name: "RemoveNFTSuppout", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "tokenId", + type: "uint256", + }, + { + indexed: true, + internalType: "address", + name: "owner", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "nftToken", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "amount", + type: "uint256", + }, + { + indexed: false, + internalType: "uint256", + name: "orderId", + type: "uint256", + }, + { + indexed: false, + internalType: "address", + name: "currency", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "price", + type: "uint256", + }, + ], + name: "SellOrder", + type: "event", + }, + { + inputs: [], + name: "MAX_TRANSACTION_FEE", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "MAX_TRANSACTION_TAX", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "MIN_TRANSACTION_FEE", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "MIN_TRANSACTION_TAX", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + name: "erc1155Supported", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + name: "erc20Supported", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + name: "erc721Supported", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "feeToAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "incrId", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + name: "nftPriceMaxLimit", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + name: "nftPriceMinLimit", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + { + internalType: "address", + name: "", + type: "address", + }, + { + internalType: "uint256[]", + name: "", + type: "uint256[]", + }, + { + internalType: "uint256[]", + name: "", + type: "uint256[]", + }, + { + internalType: "bytes", + name: "", + type: "bytes", + }, + ], + name: "onERC1155BatchReceived", + outputs: [ + { + internalType: "bytes4", + name: "", + type: "bytes4", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + { + internalType: "address", + name: "", + type: "address", + }, + { + internalType: "uint256", + name: "", + type: "uint256", + }, + { + internalType: "uint256", + name: "", + type: "uint256", + }, + { + internalType: "bytes", + name: "", + type: "bytes", + }, + ], + name: "onERC1155Received", + outputs: [ + { + internalType: "bytes4", + name: "", + type: "bytes4", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + { + internalType: "address", + name: "", + type: "address", + }, + { + internalType: "uint256", + name: "", + type: "uint256", + }, + { + internalType: "bytes", + name: "", + type: "bytes", + }, + ], + name: "onERC721Received", + outputs: [ + { + internalType: "bytes4", + name: "", + type: "bytes4", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + name: "orderInfos", + outputs: [ + { + internalType: "uint256", + name: "orderId", + type: "uint256", + }, + { + internalType: "uint256", + name: "tokenId", + type: "uint256", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + { + internalType: "address", + name: "owner", + type: "address", + }, + { + internalType: "uint256", + name: "price", + type: "uint256", + }, + { + internalType: "address", + name: "nftToken", + type: "address", + }, + { + internalType: "address", + name: "currency", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "owner", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "renounceOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes4", + name: "interfaceId", + type: "bytes4", + }, + ], + name: "supportsInterface", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "taxToAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "tranFeeTotal", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "tranTaxTotal", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "transactionFee", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "transactionTax", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "newOwner", + type: "address", + }, + ], + name: "transferOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "nftToken", + type: "address", + }, + { + internalType: "address", + name: "currency", + type: "address", + }, + { + internalType: "uint256", + name: "tokenId", + type: "uint256", + }, + { + internalType: "uint256", + name: "price", + type: "uint256", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "sell", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "orderId", + type: "uint256", + }, + ], + name: "buy", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "orderId", + type: "uint256", + }, + ], + name: "cancelOrder", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "orderId", + type: "uint256", + }, + { + internalType: "uint256", + name: "price", + type: "uint256", + }, + ], + name: "updatePrice", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "nftToken", + type: "address", + }, + ], + name: "addERC721Support", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "nftToken", + type: "address", + }, + ], + name: "removeERC721Support", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "nftToken", + type: "address", + }, + ], + name: "addERC1155Support", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "nftToken", + type: "address", + }, + ], + name: "removeERC1155Support", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "erc20", + type: "address", + }, + ], + name: "addERC20Support", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "erc20", + type: "address", + }, + ], + name: "removeERC20Support", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "nftToken", + type: "address", + }, + { + internalType: "uint256", + name: "maxLimit", + type: "uint256", + }, + ], + name: "setNFTPriceMaxLimit", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "nftToken", + type: "address", + }, + { + internalType: "uint256", + name: "minLimit", + type: "uint256", + }, + ], + name: "setNFTPriceMinLimit", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "_transactionFee", + type: "uint256", + }, + ], + name: "setTransactionFee", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_feeToAddress", + type: "address", + }, + ], + name: "setFeeToAddress", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "_transactionTax", + type: "uint256", + }, + ], + name: "setTransactionTax", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_taxToAddress", + type: "address", + }, + ], + name: "setTaxToAddress", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, +]; diff --git a/src/abis/abiUserMinterFactory.ts b/src/abis/abiUserMinterFactory.ts index 8ffd194..bf4f8eb 100644 --- a/src/abis/abiUserMinterFactory.ts +++ b/src/abis/abiUserMinterFactory.ts @@ -1,6 +1,11 @@ import { AbiItem } from "web3-utils"; export let abiMinterFactory: AbiItem[] = [ + { + inputs: [], + stateMutability: "nonpayable", + type: "constructor", + }, { anonymous: false, inputs: [ @@ -23,6 +28,12 @@ export let abiMinterFactory: AbiItem[] = [ { anonymous: false, inputs: [ + { + indexed: true, + internalType: "address", + name: "nftAddress", + type: "address", + }, { indexed: true, internalType: "address", @@ -37,67 +48,91 @@ export let abiMinterFactory: AbiItem[] = [ }, { indexed: false, + internalType: "uint256", + name: "startTime", + type: "uint256", + }, + { + indexed: false, + internalType: "uint256[]", + name: "ids", + type: "uint256[]", + }, + ], + name: "TokenMinted", + type: "event", + }, + { + inputs: [ + { + internalType: "address", + name: "signer", + type: "address", + }, + { + internalType: "bytes32", + name: "hash", + type: "bytes32", + }, + { internalType: "bytes", name: "signature", type: "bytes", }, + ], + name: "checkSigner", + outputs: [], + stateMutability: "pure", + type: "function", + }, + { + inputs: [ { - indexed: false, - internalType: "string", - name: "reason", - type: "string", + internalType: "address", + name: "signer", + type: "address", + }, + { + internalType: "bytes32", + name: "structHash", + type: "bytes32", }, { - indexed: false, internalType: "bytes", - name: "byteReason", + name: "signature", type: "bytes", }, ], - name: "TokenMintFail", - type: "event", + name: "checkSigner712", + outputs: [], + stateMutability: "view", + type: "function", }, { inputs: [], - name: "chip", + name: "executor", outputs: [ { - internalType: "contract IBEERC1155", + internalType: "address", name: "", type: "address", }, ], stateMutability: "view", type: "function", - constant: true, }, { inputs: [], - name: "equip", + name: "getDuration", outputs: [ { - internalType: "contract IBEERC721", - name: "", - type: "address", + internalType: "uint256", + name: "duration", + type: "uint256", }, ], stateMutability: "view", type: "function", - constant: true, - }, - { - inputs: [], - name: "hero", - outputs: [ - { - internalType: "contract IBEERC721", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - constant: true, }, { inputs: [], @@ -111,7 +146,6 @@ export let abiMinterFactory: AbiItem[] = [ ], stateMutability: "view", type: "function", - constant: true, }, { inputs: [], @@ -121,18 +155,23 @@ export let abiMinterFactory: AbiItem[] = [ type: "function", }, { - inputs: [], - name: "shard", - outputs: [ + inputs: [ { - internalType: "contract IBEERC1155", + internalType: "address", name: "", type: "address", }, ], + name: "tokenSupported", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], stateMutability: "view", type: "function", - constant: true, }, { inputs: [ @@ -150,12 +189,12 @@ export let abiMinterFactory: AbiItem[] = [ { inputs: [ { - internalType: "address[5]", - name: "addressArr", - type: "address[5]", + internalType: "uint256", + name: "valNew", + type: "uint256", }, ], - name: "init", + name: "updateDuation", outputs: [], stateMutability: "nonpayable", type: "function", @@ -163,76 +202,13 @@ export let abiMinterFactory: AbiItem[] = [ { inputs: [ { - internalType: "uint256", - name: "tokenId", - type: "uint256", + internalType: "address", + name: "nftAddress", + type: "address", }, - { - internalType: "uint256", - name: "startTime", - type: "uint256", - }, - { - internalType: "uint256", - name: "saltNonce", - type: "uint256", - }, - { - internalType: "bytes", - name: "signature", - type: "bytes", - }, - ], - name: "mintHeroUser", - outputs: [ - { - internalType: "bool", - name: "success", - type: "bool", - }, - ], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - { - internalType: "uint256", - name: "startTime", - type: "uint256", - }, - { - internalType: "uint256", - name: "saltNonce", - type: "uint256", - }, - { - internalType: "bytes", - name: "signature", - type: "bytes", - }, - ], - name: "mintEquipUser", - outputs: [ - { - internalType: "bool", - name: "success", - type: "bool", - }, - ], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ { internalType: "uint256[]", - name: "ids", + name: "tokenIds", type: "uint256[]", }, { @@ -251,113 +227,87 @@ export let abiMinterFactory: AbiItem[] = [ type: "bytes", }, ], - name: "mintChipBatchUser", - outputs: [ - { - internalType: "bool", - name: "success", - type: "bool", - }, - ], + name: "mintNft", + outputs: [], stateMutability: "nonpayable", type: "function", }, { inputs: [ { - internalType: "uint256[]", - name: "ids", - type: "uint256[]", - }, - { - internalType: "uint256[]", - name: "amounts", - type: "uint256[]", - }, - { - internalType: "uint256", - name: "startTime", - type: "uint256", - }, - { - internalType: "uint256", - name: "saltNonce", - type: "uint256", - }, - { - internalType: "bytes", - name: "signature", - type: "bytes", - }, - ], - name: "mintShardBatchUser", - outputs: [ - { - internalType: "bool", - name: "success", - type: "bool", + internalType: "address", + name: "nftToken", + type: "address", }, ], + name: "addTokenSupport", + outputs: [], stateMutability: "nonpayable", type: "function", }, { inputs: [ { - internalType: "uint256", - name: "nftId", - type: "uint256", + internalType: "address", + name: "nftToken", + type: "address", }, + ], + name: "removeTokenSupport", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ { - internalType: "uint8", - name: "nftType", - type: "uint8", + internalType: "address", + name: "account", + type: "address", + }, + ], + name: "updateExecutor", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_to", + type: "address", }, { internalType: "address", - name: "payToken", + name: "_nftAddress", type: "address", }, { internalType: "uint256", - name: "payAmount", - type: "uint256", - }, - { - internalType: "uint256[]", - name: "ids", - type: "uint256[]", - }, - { - internalType: "uint256[]", - name: "amounts", - type: "uint256[]", - }, - { - internalType: "uint256", - name: "startTime", + name: "_startTime", type: "uint256", }, { internalType: "uint256", - name: "saltNonce", + name: "_saltNonce", type: "uint256", }, { - internalType: "bytes", - name: "signature", - type: "bytes", + internalType: "uint256[]", + name: "_ids", + type: "uint256[]", }, ], - name: "shardMixByUser", + name: "getMessageHash", outputs: [ { - internalType: "bool", - name: "success", - type: "bool", + internalType: "bytes32", + name: "", + type: "bytes32", }, ], - stateMutability: "nonpayable", + stateMutability: "pure", type: "function", }, ]; diff --git a/src/config/cfg_421613_dev.js b/src/config/cfg_421613_dev.js index b5b6628..d4f9b67 100644 --- a/src/config/cfg_421613_dev.js +++ b/src/config/cfg_421613_dev.js @@ -8,43 +8,37 @@ module.exports = { }, { type: "erc20", - address: "0xaa34B79A0Ab433eaC900fB3CB9f191F5Cd27501D", + address: "0x8dd1439E0C3254b4543d6D68b3C0C891E5Bd2eCE", symbol: "CEC", decimal: 18, }, { type: "erc20", - address: "0xaa34B79A0Ab433eaC900fB3CB9f191F5Cd27501D", + address: "0x2C7221588D4FBac2585D71618CD540e74c7413B8", symbol: "CEG", decimal: 18, }, { - address: "0xB469331cEC98E52b7Eab07dFB586253bE232BBF7", + address: "0xE6A69474E04B93De50dd07F239d62879dB9bF716", name: "hero", type: "erc721", }, { - address: "0x2F2Ed1c403cB7156617449795dE1CB47A0302a25", + address: "0x8Ce844402bE22fA1276a375Ff2354DD27aDEF285", name: "weapon", type: "erc721", }, { - address: "0x73482411443E87CAC124C12A10B34e9Aaa2De168", + address: "0x4678fE0177B15538F441264cB851364d9F3872AA", name: "chip", - type: "erc1155", - }, - { - address: "0xFc21A863bFb4E4534B246078772e2074e076f0a7", - name: "shard", - type: "erc1155", + type: "erc721", }, ], contracts: { - nftMall: "0x1F6293c44633a50311Ec5Ab02ff14034b5c31272", - evolveFactory: "0x9e6167B11Ad15D8407865E21D4770E9F6CF10853", - minterFactory: "0xb60c7312F56da4303CE3bf27124f1850dBe1D0E5", - chipLocker: "0x4Ef766854EE104053cF2D243620b7A643fCC2B54", - nftFactory: "0xEA374dC9f94E7A3A2eE8C0C910954cE15E2C469E", - market: "0x806eA3301c2bA2a3C710D97931a6C0Fe00E45B33", + minterFactory: "0x1A27515c35a92Fb276c2670fa27C85ffAd75D094", + nftmarket: "0x1d33b4E045ce595B6346C3D0e334814dd4Af5418", + nftmall: "0x38Bf9f3C29D8384B6A79435745AE796cd2465545", + gamemarket: "0x19a13Da2E7EB33210c98B589888EA68267ee61d6", + gamemall: "0x1D058c7c7451c34BbfF9c0dF1C16b95C5d171d64", }, }; diff --git a/src/config/cfg_421613_release.js b/src/config/cfg_421613_release.js index 6c8a6b6..9ef9a81 100644 --- a/src/config/cfg_421613_release.js +++ b/src/config/cfg_421613_release.js @@ -3,48 +3,39 @@ module.exports = { { type: "eth", address: "eth", - symbol: "MATIC", + symbol: "AGOR", decimal: 18, }, { type: "erc20", - address: "0xfa513999031dC1DCf86e99d91101e17d07839236", + address: "0x8dd1439E0C3254b4543d6D68b3C0C891E5Bd2eCE", symbol: "CEC", decimal: 18, }, { type: "erc20", - address: "0x9f87eCA8F0479383fF11a5AB2336b5A6c383d6F3", + address: "0x2C7221588D4FBac2585D71618CD540e74c7413B8", symbol: "CEG", decimal: 18, }, { - address: "0x3EBF5196dADC8F3F09C808333f98FE8A4b7d1e62", + address: "0xE6A69474E04B93De50dd07F239d62879dB9bF716", name: "hero", type: "erc721", }, { - address: "0x2F2Ed1c403cB7156617449795dE1CB47A0302a25", + address: "0x8Ce844402bE22fA1276a375Ff2354DD27aDEF285", name: "weapon", type: "erc721", }, { - address: "0x73482411443E87CAC124C12A10B34e9Aaa2De168", + address: "0x4678fE0177B15538F441264cB851364d9F3872AA", name: "chip", - type: "erc1155", - }, - { - address: "0xFc21A863bFb4E4534B246078772e2074e076f0a7", - name: "shard", - type: "erc1155", + type: "erc721", }, ], contracts: { - nftMall: "0x1F6293c44633a50311Ec5Ab02ff14034b5c31272", - evolveFactory: "0x9e6167B11Ad15D8407865E21D4770E9F6CF10853", - minterFactory: "0xb60c7312F56da4303CE3bf27124f1850dBe1D0E5", - chipLocker: "0x4Ef766854EE104053cF2D243620b7A643fCC2B54", - nftFactory: "0xEA374dC9f94E7A3A2eE8C0C910954cE15E2C469E", - market: "0x806eA3301c2bA2a3C710D97931a6C0Fe00E45B33", + minterFactory: "0x1A27515c35a92Fb276c2670fa27C85ffAd75D094", + market: "0xb80E19c50747972E735c68C0BA5651AD952d70BC", }, }; diff --git a/src/config/constants.ts b/src/config/constants.ts index 00e9dcd..fe99e9c 100644 --- a/src/config/constants.ts +++ b/src/config/constants.ts @@ -1,7 +1,8 @@ export const WALLET_STORAGE_KEY_NAME = "jc_wallet_data"; // export const WALLET_API_HOST = "https://wallet.cebggame.com"; -export const WALLET_API_HOST = "http://192.168.100.184:3007"; +export const WALLET_API_HOST = "https://pay.cebggame.com"; +// export const WALLET_API_HOST = "http://192.168.100.185:3007"; export const MAX_TRY_COUNT = 6; diff --git a/src/data/allchain.ts b/src/data/allchain.ts index 2b4b0de..d309ec2 100644 --- a/src/data/allchain.ts +++ b/src/data/allchain.ts @@ -223,7 +223,7 @@ export const AllChains = [ id: 421613, network: "AGOR", symbol: "AGOR", - explorerurl: "https://goerli-rollup-explorer.arbitrum.io", + explorerurl: "https://testnet.arbiscan.io", }, { name: "Celo Mainnet RPC", diff --git a/src/services/PaySvr.ts b/src/services/PaySvr.ts index cc07f3c..2c3c10a 100644 --- a/src/services/PaySvr.ts +++ b/src/services/PaySvr.ts @@ -15,6 +15,10 @@ export class PaySvr { * @returns The result of the alchemyPrePay function. */ public async alchemyPrePay(data: IPayData) { + data.network = jc.wallet.currentChain.network; + data.crypto = data.crypto.toUpperCase(); + data.country = data.country.toUpperCase(); + data.fiat = data.fiat.toUpperCase(); let res = await reqAlchemyPrePay(data); if (res.errcode) { throw new Error(res.errmsg); @@ -26,9 +30,10 @@ export class PaySvr { if (!url) { throw new Error("No url returned"); } - jsb.showWebPage(url); + console.log("pay url::", url); + // jsb.showWebPage(url); // jsb.openURL(url); - return true; + return res.data; } public async getGasPrice(chainId: number) { diff --git a/src/standards/ERC20Standard.ts b/src/standards/ERC20Standard.ts index e0e0349..bc00d96 100644 --- a/src/standards/ERC20Standard.ts +++ b/src/standards/ERC20Standard.ts @@ -2,6 +2,7 @@ import Web3 from "web3"; import { abiERC20 } from "../abis/abiERC20"; import { BN, toUtf8 } from "ethereumjs-util"; import { universalChainCb } from "../util/chain.util"; +import { toWeiBn } from "../util/number.util"; export class ERC20Standard { private web3: Web3; @@ -146,6 +147,7 @@ export class ERC20Standard { from, to, amount, + decimal = 18, gas, estimate, }: { @@ -153,11 +155,12 @@ export class ERC20Standard { from: string; to: string; amount: number | string; + decimal?: number; gas?: number; estimate: number; }) { const contract = new this.web3.eth.Contract(abiERC20, address); - const amountBN = Web3.utils.toBN(Web3.utils.toWei(amount + "")); + let amountBN = toWeiBn(amount, decimal); if (!gas) { gas = await contract.methods.transfer(to, "0").estimateGas(); } diff --git a/src/standards/JCStandard.ts b/src/standards/JCStandard.ts index 37a6963..74b057c 100644 --- a/src/standards/JCStandard.ts +++ b/src/standards/JCStandard.ts @@ -1,13 +1,13 @@ import assert from "assert"; import Web3 from "web3"; -import { abiNftMall } from "../abis/abiBENftMall"; -import { abiChipLocker } from "../abis/abiChipLocker"; -import { abiERC1155 } from "../abis/abiERC1155"; -import { abiEvolveFactory } from "../abis/abiUserEvolveFactory"; import { abiMinterFactory } from "../abis/abiUserMinterFactory"; import { ZERO_ADDRESS } from "../config/constants"; import { getAddressByName, universalChainCb } from "../util/chain.util"; import { SAMPLE_GAS } from "./ChainCommon"; +import { abiMarket } from "../abis/abiMarket"; +import { abiMall } from "../abis/abiMall"; +import { abiGameMarket } from "../abis/abiGameMarket"; +import { abiGameMall } from "../abis/abiGameMall"; export class JCStandard { private web3: Web3; @@ -16,704 +16,434 @@ export class JCStandard { this.web3 = web3; } - async buyNft721({ - addresses, - values, - signature, - gas, - estimate, - }: { - addresses: string[]; - values: string[]; - signature: string; - gas?: number; - estimate: number; - }) { - let address = jc.wallet.currentChainCfg.contracts.nftMall; - const contract = new this.web3.eth.Contract(abiNftMall, address, { - //@ts-ignore - from: jc.wallet.currentAccAddr, - }); - if (!gas) { - try { - gas = await contract.methods - .buy721NFT(addresses, values, signature) - .estimateGas(); - } catch (err) {} - gas = gas ? (gas * 1.1) | 1 : SAMPLE_GAS; - } - //@ts-ignore - if (jc.wallet.isInternal) { - if (estimate) { - return jc.wallet.generateGasShow(gas); - } - //@ts-ignore - let ethEnough = await jc.wallet.chainCommon.checkEthEnough(gas); - if (!ethEnough) { - throw "eth not enough"; - } - } - - //@ts-ignore - if (!jc.wallet.isInternal) { - setTimeout(() => { - // @ts-ignore - jumpToWallet(); - }, 1500); - } - const details = []; - // payment token - const feeAddress = await jc.wallet.getFeeAddress("nftMall"); - details.push({ - address: addresses[2], - from: jc.wallet.currentAccAddr, - to: feeAddress, - value: values[1], - }); - // nft minted - details.push({ - address: addresses[1], - from: ZERO_ADDRESS, - to: jc.wallet.currentAccAddr, - id: values[0], - }); - - const logData = { - gas, - title: "buy_erc721", - details, - }; - return universalChainCb( - logData, - contract.methods.buy721NFT(addresses, values, signature).send({ gas }) - ); - } - - async buyNft1155({ - addresses, - values, - ids, - amounts, - signature, - gas, - estimate, - }: { - addresses: string[]; - values: string[]; - ids: string[]; - amounts: string[]; - signature: string; - gas?: number; - estimate: number; - }) { - let address = jc.wallet.currentChainCfg.contracts.nftMall; - const contract = new this.web3.eth.Contract(abiNftMall, address, { - //@ts-ignore - from: jc.wallet.currentAccAddr, - }); - if (!gas) { - try { - gas = await contract.methods - .buy1155NFT(addresses, values, ids, amounts, signature) - .estimateGas(); - } catch (err) {} - gas = gas ? (gas * 1.1) | 1 : SAMPLE_GAS; - } - - //@ts-ignore - if (jc.wallet.isInternal) { - if (estimate) { - return jc.wallet.generateGasShow(gas); - } - //@ts-ignore - let ethEnough = await jc.wallet.chainCommon.checkEthEnough(gas); - if (!ethEnough) { - throw "eth not enough"; - } - } - //@ts-ignore - if (!jc.wallet.isInternal) { - setTimeout(() => { - // @ts-ignore - jumpToWallet(); - }, 1500); - } - const details = []; - // payment token - const feeAddress = await jc.wallet.getFeeAddress("nftMall"); - details.push({ - address: addresses[2], - from: jc.wallet.currentAccAddr, - to: feeAddress, // can't fetch address in contract, use seller instead - value: values[0], - }); - // 1155 token minted - for (let i = 0, l = ids.length; i < l; i++) { - details.push({ - address: addresses[1], - from: ZERO_ADDRESS, - to: jc.wallet.currentAccAddr, - id: ids[i], - value: amounts[i], - }); - } - - const logData = { - gas, - title: "buy_erc1155", - details, - }; - return universalChainCb( - logData, - contract.methods - .buy1155NFT(addresses, values, ids, amounts, signature) - .send({ gas }) - ); - } - - async evolve721NFT({ - nftAddress, + async mintNFT({ + address, tokenIds, startTime, - nonce, + saltNonce, signature, gas, estimate, }: { - nftAddress: string; + address: string; tokenIds: string[]; - startTime: number; - nonce: string; + startTime: string; + saltNonce: string; signature: string; gas?: number; estimate: number; }) { - let address = jc.wallet.currentChainCfg.contracts.evolveFactory; - const contract = new this.web3.eth.Contract(abiEvolveFactory, address, { - //@ts-ignore - from: jc.wallet.currentAccAddr, - }); - if (!gas) { - try { - gas = await contract.methods - .evolve721NFT(nftAddress, tokenIds, startTime, nonce, signature) - .estimateGas(); - } catch (err) {} - gas = gas ? (gas * 1.1) | 1 : SAMPLE_GAS; - } - - //@ts-ignore - if (jc.wallet.isInternal) { - if (estimate) { - return jc.wallet.generateGasShow(gas); - } - //@ts-ignore - let ethEnough = await jc.wallet.chainCommon.checkEthEnough(gas); - if (!ethEnough) { - throw "eth not enough"; - } - } - //@ts-ignore - if (!jc.wallet.isInternal) { - setTimeout(() => { - // @ts-ignore - jumpToWallet(); - }, 1500); - } - const details = []; - // nft evolved - details.push({ - address: nftAddress, - from: jc.wallet.currentAccAddr, - to: jc.wallet.currentAccAddr, - id: tokenIds[0], - }); - // nft burn - details.push({ - address: nftAddress, - from: jc.wallet.currentAccAddr, - to: ZERO_ADDRESS, - id: tokenIds[1], - }); - const logData = { - gas, - title: "evolve_721", - details, - }; - return universalChainCb( - logData, - contract.methods - .evolve721NFT(nftAddress, tokenIds, startTime, nonce, signature) - .send({ gas }) - ); - } - - async evolveChip({ - tokenIds, - startTime, - nonce, - signature, - gas, - estimate, - }: { - tokenIds: string[]; - startTime: number; - nonce: string; - signature: string; - gas?: number; - estimate: number; - }) { - let address = jc.wallet.currentChainCfg.contracts.evolveFactory; - const contract = new this.web3.eth.Contract(abiEvolveFactory, address, { - //@ts-ignore - from: jc.wallet.currentAccAddr, - }); - if (gas) { - try { - gas = await contract.methods - .evolveChip(tokenIds, startTime, nonce, signature) - .estimateGas(); - } catch (err) {} - gas = gas ? (gas * 1.1) | 1 : SAMPLE_GAS; - } - - //@ts-ignore - if (jc.wallet.isInternal) { - if (estimate) { - return jc.wallet.generateGasShow(gas); - } - //@ts-ignore - let ethEnough = await jc.wallet.chainCommon.checkEthEnough(gas); - if (!ethEnough) { - throw "eth not enough"; - } - } - //@ts-ignore - if (!jc.wallet.isInternal) { - setTimeout(() => { - // @ts-ignore - jumpToWallet(); - }, 1500); - } - const details = []; - const chipAddress = getAddressByName("chip"); - assert(!!chipAddress, "chip address not found"); - // chip evolved - details.push({ - address: chipAddress, - from: jc.wallet.currentAccAddr, - to: jc.wallet.currentAccAddr, - id: tokenIds[0], - value: 1, - }); - // chip burn - for (let i = 1, l = tokenIds.length; i < l; i++) { - details.push({ - address: chipAddress, + const cfg = jc.wallet.currentChainCfg; + const addressFactory = cfg.contracts.minterFactory; + console.log("addressFactory:: ", addressFactory); + const contract = new this.web3.eth.Contract( + abiMinterFactory, + addressFactory, + { + //@ts-ignore from: jc.wallet.currentAccAddr, - to: ZERO_ADDRESS, - id: tokenIds[i], - value: 1, - }); - } - - const logData = { - gas, - title: "evolve_chip", - details, - }; - return universalChainCb( - logData, - contract.methods - .evolveChip(tokenIds, startTime, nonce, signature) - .send({ gas }) + } ); - } - - async mintShardBatchUser({ - tokenIds, - amounts, - startTime, - nonce, - signature, - gas, - estimate, - }: { - tokenIds: string[]; - amounts: number[]; - startTime: number; - nonce: string; - signature: string; - gas?: number; - estimate: number; - }) { - let address = jc.wallet.currentChainCfg.contracts.minterFactory; - const contract = new this.web3.eth.Contract(abiMinterFactory, address, { - //@ts-ignore - from: jc.wallet.currentAccAddr, - }); if (!gas) { - try { - gas = await contract.methods - .mintShardBatchUser(tokenIds, amounts, startTime, nonce, signature) - .estimateGas(); - } catch (err) {} - gas = gas ? (gas * 1.1) | 1 : SAMPLE_GAS; + gas = await contract.methods + .mintNft(address, tokenIds, startTime, saltNonce, signature) + .estimateGas(); + } + gas = (gas * 1.1) | 1; + if (estimate) { + return jc.wallet.generateGasShow(gas); } - //@ts-ignore - if (jc.wallet.isInternal) { - if (estimate) { - return jc.wallet.generateGasShow(gas); - } - //@ts-ignore - let ethEnough = await jc.wallet.chainCommon.checkEthEnough(gas); - if (!ethEnough) { - throw "eth not enough"; - } - } - //@ts-ignore - if (!jc.wallet.isInternal) { - setTimeout(() => { - // @ts-ignore - jumpToWallet(); - }, 1500); - } - const details = []; - const shardAddress = getAddressByName("shard"); - assert(!!shardAddress, "shard address not found"); - // shard - for (let i = 0, l = tokenIds.length; i < l; i++) { + let details = []; + for (let tokenId of tokenIds) { details.push({ - address: shardAddress, + address, from: ZERO_ADDRESS, to: jc.wallet.currentAccAddr, - id: tokenIds[i], - value: amounts[i], + id: tokenId, }); } - const logData = { gas, - title: "mint_shard", - details, + title: "mint_nft", + details: details, }; return universalChainCb( logData, contract.methods - .mintShardBatchUser(tokenIds, amounts, startTime, nonce, signature) + .mintNft(address, tokenIds, startTime, saltNonce, signature) .send({ gas }) ); } - - async shardMixByUser({ + // begin of NFT Market + async marketSellNFT({ + nftToken, + currency, tokenId, - nftType, - payToken, - payAmount, - ids, - amounts, - startTime, - nonce, - signature, + price, + amount, gas, estimate, }: { + nftToken: string; + currency: string; tokenId: string; - nftType: number; - payToken: string; - payAmount: number; - ids: string[]; - amounts: number[]; - startTime: number; - nonce: string; - signature: string; + price: string; + amount: string; gas?: number; estimate: number; }) { - let address = jc.wallet.currentChainCfg.contracts.minterFactory; - const contract = new this.web3.eth.Contract(abiMinterFactory, address, { + const cfg = jc.wallet.currentChainCfg; + const addressMarket = cfg.contracts.nftmarket; + console.log("addressMarket:: ", addressMarket); + const contract = new this.web3.eth.Contract(abiMarket, addressMarket, { //@ts-ignore from: jc.wallet.currentAccAddr, }); if (!gas) { - try { - gas = await contract.methods - .shardMixByUser( - tokenId, - nftType, - payToken, - payAmount, - ids, - amounts, - startTime, - nonce, - signature - ) - .estimateGas(); - } catch (err) {} - gas = gas ? (gas * 1.1) | 1 : SAMPLE_GAS; + gas = await contract.methods + .sell(nftToken, currency, tokenId, price, amount) + .estimateGas(); + } + gas = (gas * 1.1) | 1; + if (estimate) { + return jc.wallet.generateGasShow(gas); } - //@ts-ignore - if (jc.wallet.isInternal) { - if (estimate) { - return jc.wallet.generateGasShow(gas); - } - //@ts-ignore - let ethEnough = await jc.wallet.chainCommon.checkEthEnough(gas); - if (!ethEnough) { - throw "eth not enough"; - } - } - //@ts-ignore - if (!jc.wallet.isInternal) { - setTimeout(() => { - // @ts-ignore - jumpToWallet(); - }, 1500); - } - - const details = []; - const shardAddress = getAddressByName("shard"); - assert(!!shardAddress, "shard address not found"); - // nft mint - const nftTypeName = nftType === 0 ? "hero" : "weapon"; - const nftAddress = getAddressByName(nftTypeName); - assert(!!nftAddress, "nft address not found"); - details.push({ - address: nftAddress, - from: ZERO_ADDRESS, - to: jc.wallet.currentAccAddr, - id: tokenId, - value: 1, - }); - // payment token - const feeAddress = await jc.wallet.getFeeAddress("nftFactory"); - details.push({ - address: payToken, - from: jc.wallet.currentAccAddr, - to: feeAddress, - value: payAmount, - }); - // shard burn - for (let i = 0, l = ids.length; i < l; i++) { - details.push({ - address: shardAddress, + let details = [ + { + address: nftToken, from: jc.wallet.currentAccAddr, - to: ZERO_ADDRESS, - id: ids[i], - value: amounts[i], - }); - } - + to: addressMarket, + id: tokenId, + }, + ]; const logData = { gas, - title: "shard_mix", - details, + title: "market_sell", + details: details, }; return universalChainCb( logData, contract.methods - .shardMixByUser( - tokenId, - nftType, - payToken, - payAmount, - ids, - amounts, - startTime, - nonce, - signature - ) + .sell(nftToken, currency, tokenId, price, amount) .send({ gas }) ); } - async pluginChip({ + async marketUpdatePrice({ + orderId, + price, + gas, + estimate, + }: { + orderId: string; + price: string; + gas?: number; + estimate: number; + }) { + const cfg = jc.wallet.currentChainCfg; + const addressMarket = cfg.contracts.nftmarket; + console.log("addressMarket:: ", addressMarket); + const contract = new this.web3.eth.Contract(abiMarket, addressMarket, { + //@ts-ignore + from: jc.wallet.currentAccAddr, + }); + if (!gas) { + gas = await contract.methods.updatePrice(orderId, price).estimateGas(); + } + gas = (gas * 1.1) | 1; + if (estimate) { + return jc.wallet.generateGasShow(gas); + } + + let details = [ + { + address: addressMarket, + from: jc.wallet.currentAccAddr, + to: addressMarket, + value: 0, + }, + ]; + const logData = { + gas, + title: "market_update_price", + details: details, + }; + return universalChainCb( + logData, + contract.methods.updatePrice(orderId, price).send({ gas }) + ); + } + + async marketCancelOrder({ + orderId, + gas, + estimate, + }: { + orderId: string; + gas?: number; + estimate: number; + }) { + const cfg = jc.wallet.currentChainCfg; + const addressMarket = cfg.contracts.nftmarket; + console.log("addressMarket:: ", addressMarket); + const contract = new this.web3.eth.Contract(abiMarket, addressMarket, { + //@ts-ignore + from: jc.wallet.currentAccAddr, + }); + if (!gas) { + gas = await contract.methods.cancelOrder(orderId).estimateGas(); + } + gas = (gas * 1.1) | 1; + if (estimate) { + return jc.wallet.generateGasShow(gas); + } + + let details = [ + { + address: addressMarket, + from: jc.wallet.currentAccAddr, + to: addressMarket, + value: 0, + }, + ]; + const logData = { + gas, + title: "market_cancel_order", + details: details, + }; + return universalChainCb( + logData, + contract.methods.cancelOrder(orderId).send({ gas }) + ); + } + + async marketBuy({ + orderId, + gas, + estimate, + }: { + orderId: string; + gas?: number; + estimate: number; + }) { + const cfg = jc.wallet.currentChainCfg; + const addressMarket = cfg.contracts.nftmarket; + console.log("addressMarket:: ", addressMarket); + const contract = new this.web3.eth.Contract(abiMarket, addressMarket, { + //@ts-ignore + from: jc.wallet.currentAccAddr, + }); + if (!gas) { + gas = await contract.methods.buy(orderId).estimateGas(); + } + gas = (gas * 1.1) | 1; + if (estimate) { + return jc.wallet.generateGasShow(gas); + } + + let details = [ + { + address: addressMarket, + from: jc.wallet.currentAccAddr, + to: addressMarket, + value: 0, + }, + ]; + const logData = { + gas, + title: "market_buy", + details: details, + }; + return universalChainCb( + logData, + contract.methods.buy(orderId).send({ gas }) + ); + } + + // end of NFT Market + + // begin of NFT Mall + async mallBuy({ addresses, values, - chipIds, - slots, - signature, gas, estimate, }: { addresses: string[]; values: string[]; - chipIds: string[]; - slots: string[]; - signature: string; gas?: number; estimate: number; }) { - let lockerAddress = jc.wallet.currentChainCfg.contracts.chipLocker; - const contract = new this.web3.eth.Contract(abiChipLocker, lockerAddress, { + const cfg = jc.wallet.currentChainCfg; + const addressMall = cfg.contracts.nftmall; + console.log("addressMall:: ", addressMall); + const contract = new this.web3.eth.Contract(abiMall, addressMall, { + //@ts-ignore from: jc.wallet.currentAccAddr, }); - let chipInstance = new this.web3.eth.Contract(abiERC1155, addresses[1], { - from: jc.wallet.currentAccAddr, - }); - if (!jc.wallet.isInternal) { - setTimeout(() => { - // @ts-ignore - jumpToWallet(); - }, 1500); - } - let gas1 = SAMPLE_GAS; - let gas0 = SAMPLE_GAS; - try { - gas1 = await chipInstance.methods - .setApprovalForAll(lockerAddress, true) - .estimateGas(); - gas0 = await contract.methods - .pluginChip(addresses, values, chipIds, slots, signature) - .estimateGas(); - } catch (err) {} if (!gas) { - gas1 = gas1 ? (gas1 * 1.1) | 1 : SAMPLE_GAS; - gas0 = gas0 ? (gas0 * 1.1) | 1 : SAMPLE_GAS; - gas = gas0 + gas1; - } else { - gas0 = gas - gas1; + gas = await contract.methods.buyNFT(addresses, values).estimateGas(); } - if (gas < gas1) { - throw "gas is too low"; + gas = (gas * 1.1) | 1; + if (estimate) { + return jc.wallet.generateGasShow(gas); } - if (jc.wallet.isInternal) { - if (estimate) { - return jc.wallet.generateGasShow(gas); - } - let ethEnough = await jc.wallet.chainCommon.checkEthEnough(gas1); - if (!ethEnough) { - throw "eth not enough"; - } - } - await chipInstance.methods - .setApprovalForAll(lockerAddress, true) - .send({ gas: gas1 }); - - if (jc.wallet.isInternal) { - let ethEnough = await jc.wallet.chainCommon.checkEthEnough(gas0); - if (!ethEnough) { - throw "eth not enough"; - } - } - if (!jc.wallet.isInternal) { - setTimeout(() => { - // @ts-ignore - jumpToWallet(); - }, 1500); - } - const details = []; - // target nft - details.push({ - address: addresses[0], - from: jc.wallet.currentAccAddr, - to: jc.wallet.currentAccAddr, - id: values[0], - }); - // chip plugin - for (let i = 0, l = chipIds.length; i < l; i++) { - details.push({ - address: addresses[1], + let details = [ + { + address: addressMall, from: jc.wallet.currentAccAddr, - to: lockerAddress, - id: chipIds[i], - value: 1, - }); - } - - const logData = { - gas, - title: "plug_chip", - details, - }; - return universalChainCb( - logData, - contract.methods - .pluginChip(addresses, values, chipIds, slots, signature) - .send({ gas }) - ); - } - - async unplugChip({ - addresses, - values, - chipIds, - slots, - signature, - gas, - estimate, - }: { - addresses: string[]; - values: string[]; - chipIds: string[]; - slots: string[]; - signature: string; - gas?: number; - estimate: number; - }) { - let lockerAddress = jc.wallet.currentChainCfg.contracts.chipLocker; - const contract = new this.web3.eth.Contract(abiChipLocker, lockerAddress, { - from: jc.wallet.currentAccAddr, - }); - if (!gas) { - try { - gas = await contract.methods - .unplugChip(addresses, values, chipIds, slots, signature) - .estimateGas(); - } catch (err) { - console.log(err); - } - gas = gas ? (gas * 1.1) | 1 : SAMPLE_GAS; - } - - if (jc.wallet.isInternal) { - if (estimate) { - return jc.wallet.generateGasShow(gas); - } - let ethEnough = await jc.wallet.chainCommon.checkEthEnough(gas); - if (!ethEnough) { - throw "eth not enough"; - } - } - if (!jc.wallet.isInternal) { - setTimeout(() => { - // @ts-ignore - jumpToWallet(); - }, 1500); - } - const details = []; - // target nft - details.push({ - address: addresses[0], - from: jc.wallet.currentAccAddr, - to: jc.wallet.currentAccAddr, - id: values[0], - }); - // chip plugin - for (let i = 0, l = chipIds.length; i < l; i++) { - details.push({ + to: addressMall, + value: 0, + }, + { address: addresses[1], - from: lockerAddress, + from: addresses[0], to: jc.wallet.currentAccAddr, - id: chipIds[i], - value: 1, - }); - } - + value: values[0], + }, + { + address: addresses[2], + from: jc.wallet.currentAccAddr, + to: addresses[0], + value: values[1], + }, + ]; const logData = { gas, - title: "unplug_chip", - details, + title: "mall_buy_nft", + details: details, + }; + return universalChainCb( + logData, + contract.methods.buyNFT(addresses, values).send({ gas }) + ); + } + // end of NFT Mall + + // begin of game item market + async gameMarketBuy({ + orderId, + seller, + currency, + price, + startTime, + saltNonce, + signature, + gas, + estimate, + }: { + orderId: string; + seller: string; + currency: string; + price: string; + startTime: string; + saltNonce: string; + signature: string; + gas?: number; + estimate: number; + }) { + const cfg = jc.wallet.currentChainCfg; + const addressGameMarket = cfg.contracts.gamemarket; + console.log("addressGameMarket:: ", addressGameMarket); + const contract = new this.web3.eth.Contract( + abiGameMarket, + addressGameMarket, + { + //@ts-ignore + from: jc.wallet.currentAccAddr, + } + ); + if (!gas) { + gas = await contract.methods + .buy(orderId, seller, currency, price, startTime, saltNonce, signature) + .estimateGas(); + } + gas = (gas * 1.1) | 1; + if (estimate) { + return jc.wallet.generateGasShow(gas); + } + + let details = [ + { + address: addressGameMarket, + from: jc.wallet.currentAccAddr, + to: addressGameMarket, + value: 0, + }, + ]; + const logData = { + gas, + title: "game_market_buy", + details: details, }; return universalChainCb( logData, contract.methods - .unplugChip(addresses, values, chipIds, slots, signature) + .buy(orderId, seller, currency, price, startTime, saltNonce, signature) .send({ gas }) ); } + // end of game item market + + // begin of game item mall + async gameMallBuy({ + orderId, + currency, + price, + startTime, + saltNonce, + signature, + gas, + estimate, + }: { + orderId: string; + currency: string; + price: string; + startTime: string; + saltNonce: string; + signature: string; + gas?: number; + estimate: number; + }) { + const cfg = jc.wallet.currentChainCfg; + const addressGameMall = cfg.contracts.gamemall; + console.log("addressGameMall:: ", addressGameMall); + const contract = new this.web3.eth.Contract(abiGameMall, addressGameMall, { + //@ts-ignore + from: jc.wallet.currentAccAddr, + }); + if (!gas) { + gas = await contract.methods + .buy(orderId, currency, price, startTime, saltNonce, signature) + .estimateGas(); + } + gas = (gas * 1.1) | 1; + if (estimate) { + return jc.wallet.generateGasShow(gas); + } + // TOTO:: + let details = [ + { + address: addressGameMall, + from: jc.wallet.currentAccAddr, + to: addressGameMall, + value: 0, + }, + ]; + const logData = { + gas, + title: "game_mall_buy", + details: details, + }; + return universalChainCb( + logData, + contract.methods + .buy(orderId, currency, price, startTime, saltNonce, signature) + .send({ gas }) + ); + } + // end of game item mall } diff --git a/src/types/data.types.ts b/src/types/data.types.ts index b33443f..d5b1371 100644 --- a/src/types/data.types.ts +++ b/src/types/data.types.ts @@ -10,7 +10,12 @@ export interface IChainData { } export interface IPayData { + network: string; + crypto: string; address: string; - chain: string; - currency: string; + fiat: string; + faitAmount: string; + country: string; + accountId?: string; + orderId?: string; } diff --git a/src/util/number.util.ts b/src/util/number.util.ts index 7a4b056..aca27d8 100644 --- a/src/util/number.util.ts +++ b/src/util/number.util.ts @@ -171,6 +171,21 @@ export function stripHexPrefix(str: string) { return str.slice(0, 2) === "0x" ? str.slice(2) : str; } +// TODO:: test +export function toWeiBn(amount: string | number, decimal: number) { + let amountBN = Web3.utils.toBN(Web3.utils.toWei(amount + "")); + if (decimal > 18) { + amountBN = amountBN.mul( + Web3.utils.toBN(10).pow(Web3.utils.toBN(decimal - 18)) + ); + } else if (decimal < 18) { + amountBN = amountBN.div( + Web3.utils.toBN(10).pow(Web3.utils.toBN(18 - decimal)) + ); + } + return amountBN; +} + export function numberToBN(arg) { if (typeof arg === "string" || typeof arg === "number") { var multiplier = Web3.utils.toBN(1); // eslint-disable-line