增加market和mall的相关方法

This commit is contained in:
CounterFire2023 2023-06-15 18:50:52 +08:00
parent 28a639f13d
commit fc0cef2074
14 changed files with 2737 additions and 841 deletions

388
src/abis/abiGameMall.ts Normal file
View File

@ -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",
},
];

461
src/abis/abiGameMarket.ts Normal file
View File

@ -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",
},
];

418
src/abis/abiMall.ts Normal file
View File

@ -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",
},
];

935
src/abis/abiMarket.ts Normal file
View File

@ -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",
},
];

View File

@ -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",
},
];

View File

@ -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",
},
};

View File

@ -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",
},
};

View File

@ -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;

View File

@ -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",

View File

@ -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) {

View File

@ -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();
}

File diff suppressed because it is too large Load Diff

View File

@ -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;
}

View File

@ -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