mm_contract 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,303 +0,0 @@
1
- [
2
- {
3
- "inputs": [],
4
- "name": "coin",
5
- "outputs": [
6
- {
7
- "internalType": "address",
8
- "name": "",
9
- "type": "address"
10
- }
11
- ],
12
- "stateMutability": "view",
13
- "type": "function"
14
- },
15
- {
16
- "inputs": [
17
- {
18
- "internalType": "uint256",
19
- "name": "_num",
20
- "type": "uint256"
21
- }
22
- ],
23
- "name": "getPrice",
24
- "outputs": [
25
- {
26
- "internalType": "uint256",
27
- "name": "",
28
- "type": "uint256"
29
- }
30
- ],
31
- "stateMutability": "view",
32
- "type": "function"
33
- },
34
- {
35
- "inputs": [],
36
- "name": "getPriceNow",
37
- "outputs": [
38
- {
39
- "internalType": "uint256",
40
- "name": "",
41
- "type": "uint256"
42
- }
43
- ],
44
- "stateMutability": "view",
45
- "type": "function"
46
- },
47
- {
48
- "inputs": [],
49
- "name": "getSurplusNum",
50
- "outputs": [
51
- {
52
- "internalType": "uint256",
53
- "name": "",
54
- "type": "uint256"
55
- }
56
- ],
57
- "stateMutability": "view",
58
- "type": "function"
59
- },
60
- {
61
- "inputs": [],
62
- "name": "growPrice",
63
- "outputs": [
64
- {
65
- "internalType": "uint256",
66
- "name": "",
67
- "type": "uint256"
68
- }
69
- ],
70
- "stateMutability": "view",
71
- "type": "function"
72
- },
73
- {
74
- "inputs": [],
75
- "name": "incomeAddress",
76
- "outputs": [
77
- {
78
- "internalType": "address",
79
- "name": "",
80
- "type": "address"
81
- }
82
- ],
83
- "stateMutability": "view",
84
- "type": "function"
85
- },
86
- {
87
- "inputs": [],
88
- "name": "initPrice",
89
- "outputs": [
90
- {
91
- "internalType": "uint256",
92
- "name": "",
93
- "type": "uint256"
94
- }
95
- ],
96
- "stateMutability": "view",
97
- "type": "function"
98
- },
99
- {
100
- "inputs": [],
101
- "name": "logs",
102
- "outputs": [
103
- {
104
- "components": [
105
- {
106
- "internalType": "address",
107
- "name": "payer",
108
- "type": "address"
109
- },
110
- {
111
- "internalType": "uint256",
112
- "name": "num",
113
- "type": "uint256"
114
- },
115
- {
116
- "internalType": "uint256",
117
- "name": "total",
118
- "type": "uint256"
119
- },
120
- {
121
- "internalType": "uint256",
122
- "name": "timestamp",
123
- "type": "uint256"
124
- }
125
- ],
126
- "internalType": "struct IVipShop.Log[]",
127
- "name": "",
128
- "type": "tuple[]"
129
- }
130
- ],
131
- "stateMutability": "view",
132
- "type": "function"
133
- },
134
- {
135
- "inputs": [],
136
- "name": "markupNum",
137
- "outputs": [
138
- {
139
- "internalType": "uint256",
140
- "name": "",
141
- "type": "uint256"
142
- }
143
- ],
144
- "stateMutability": "view",
145
- "type": "function"
146
- },
147
- {
148
- "inputs": [],
149
- "name": "maxPrice",
150
- "outputs": [
151
- {
152
- "internalType": "uint256",
153
- "name": "",
154
- "type": "uint256"
155
- }
156
- ],
157
- "stateMutability": "view",
158
- "type": "function"
159
- },
160
- {
161
- "inputs": [],
162
- "name": "reserve",
163
- "outputs": [
164
- {
165
- "internalType": "uint256",
166
- "name": "",
167
- "type": "uint256"
168
- }
169
- ],
170
- "stateMutability": "view",
171
- "type": "function"
172
- },
173
- {
174
- "inputs": [],
175
- "name": "sellNum",
176
- "outputs": [
177
- {
178
- "internalType": "uint256",
179
- "name": "",
180
- "type": "uint256"
181
- }
182
- ],
183
- "stateMutability": "view",
184
- "type": "function"
185
- },
186
- {
187
- "inputs": [
188
- {
189
- "internalType": "address",
190
- "name": "_value",
191
- "type": "address"
192
- }
193
- ],
194
- "name": "setCoin",
195
- "outputs": [],
196
- "stateMutability": "nonpayable",
197
- "type": "function"
198
- },
199
- {
200
- "inputs": [
201
- {
202
- "internalType": "uint256",
203
- "name": "_value",
204
- "type": "uint256"
205
- }
206
- ],
207
- "name": "setGrowPrice",
208
- "outputs": [],
209
- "stateMutability": "nonpayable",
210
- "type": "function"
211
- },
212
- {
213
- "inputs": [
214
- {
215
- "internalType": "address",
216
- "name": "_address",
217
- "type": "address"
218
- }
219
- ],
220
- "name": "setIncomeAddress",
221
- "outputs": [],
222
- "stateMutability": "nonpayable",
223
- "type": "function"
224
- },
225
- {
226
- "inputs": [
227
- {
228
- "internalType": "uint256",
229
- "name": "_value",
230
- "type": "uint256"
231
- }
232
- ],
233
- "name": "setInitPrice",
234
- "outputs": [],
235
- "stateMutability": "nonpayable",
236
- "type": "function"
237
- },
238
- {
239
- "inputs": [
240
- {
241
- "internalType": "uint256",
242
- "name": "_value",
243
- "type": "uint256"
244
- }
245
- ],
246
- "name": "setMaxPrice",
247
- "outputs": [],
248
- "stateMutability": "nonpayable",
249
- "type": "function"
250
- },
251
- {
252
- "inputs": [
253
- {
254
- "internalType": "uint256",
255
- "name": "_value",
256
- "type": "uint256"
257
- }
258
- ],
259
- "name": "setReserve",
260
- "outputs": [],
261
- "stateMutability": "nonpayable",
262
- "type": "function"
263
- },
264
- {
265
- "inputs": [
266
- {
267
- "internalType": "address",
268
- "name": "_value",
269
- "type": "address"
270
- }
271
- ],
272
- "name": "setVIP",
273
- "outputs": [],
274
- "stateMutability": "nonpayable",
275
- "type": "function"
276
- },
277
- {
278
- "inputs": [
279
- {
280
- "internalType": "address",
281
- "name": "_addr",
282
- "type": "address"
283
- }
284
- ],
285
- "name": "upVIP",
286
- "outputs": [],
287
- "stateMutability": "nonpayable",
288
- "type": "function"
289
- },
290
- {
291
- "inputs": [],
292
- "name": "vip",
293
- "outputs": [
294
- {
295
- "internalType": "address",
296
- "name": "",
297
- "type": "address"
298
- }
299
- ],
300
- "stateMutability": "view",
301
- "type": "function"
302
- }
303
- ]
package/demo/index.js DELETED
@@ -1,63 +0,0 @@
1
- var mm_contract = require('../index.js');
2
-
3
- /**
4
- * 调用合约所需配置
5
- * @property {String} contract_address 合约地址
6
- * @property {String} user_address 用户地址
7
- */
8
- var config = {
9
- account_address: "0x404f94B549A7538dd403986FBd2C92a8Cff122Bf",
10
- chainId: 97,
11
- chainName: "BSC"
12
- };
13
-
14
- /**
15
- * 测试方法
16
- */
17
- async function test() {
18
- var ct = new mm_contract(config);
19
- var web3 = ct.init();
20
-
21
- ct.nft = {
22
- "TEST": {
23
- address: "0xe7b4856fE12B4f008a6a347c33a14E9564a051B2"
24
- }
25
- }
26
-
27
- // var contract = new web3.eth.Contract(abi, config.contract_address);
28
- // var ret = await contract.methods.getNFTsOf("0x404f94B549A7538dd403986FBd2C92a8Cff122Bf").call();
29
- // $.log.debug(ret);
30
-
31
- var ret = await ct.call("nft", "TEST", "getNFTsOf", "0x404f94B549A7538dd403986FBd2C92a8Cff122Bf");
32
- $.log.debug(ret);
33
- // var balance = await ct.getBalance("0x404f94B549A7538dd403986FBd2C92a8Cff122Bf");
34
- // $.log.debug(balance);
35
-
36
- // var ret_post = await ct.send("nft", "TEST", "approve", "0xe7b4856fE12B4f008a6a347c33a14E9564a051B2", 1000000000000000);
37
- // $.log.debug(ret_post);
38
- // $.log.debug(contract.methods.balanceOf("0x404f94B549A7538dd403986FBd2C92a8Cff122Bf").call());
39
- // var chain = contract.at(config.contract_address);
40
- // $.log.debug(chain);
41
- // var account_one = web3.eth.accounts[0];
42
- // $.log.debug(account_one);
43
- // var balance = await contract.methods.balanceOf("0x404f94B549A7538dd403986FBd2C92a8Cff122Bf").call({
44
- // from: "0x404f94B549A7538dd403986FBd2C92a8Cff122Bf"
45
- // });
46
- // $.log.debug(balance);
47
- // var nft_info = await contract.methods.getNFTsOf("0x404f94B549A7538dd403986FBd2C92a8Cff122Bf").call({
48
- // from: "0x404f94B549A7538dd403986FBd2C92a8Cff122Bf"
49
- // });
50
- // $.log.debug(nft_info);
51
-
52
- // // 查询余额
53
- // var balance = await mm.getBalance();
54
- // $.log.debug('当前余额', balance);
55
- // var hex = mm.toHex({name:12});
56
- // $.log.debug('对象转哈希', hex);
57
-
58
- // var obj = mm.toObj(hex);
59
- // $.log.debug('哈希转对象', obj);
60
- // $.log.debug(mm.toHash("666"));
61
- }
62
-
63
- test();
package/demo/index_2.js DELETED
@@ -1,31 +0,0 @@
1
- var mm_contract = require('../index.js');
2
-
3
- /**
4
- * 调用合约所需配置
5
- * @property {String} contract_address 合约地址
6
- * @property {String} user_address 用户地址
7
- */
8
- var config = {
9
- contract_address: "",
10
- account_address: ""
11
- };
12
-
13
- /**
14
- * 测试方法
15
- */
16
- async function test(){
17
- var mm = new mm_contract(config);
18
- var web3 = mm.init();
19
-
20
- // 查询余额
21
- var balance = await mm.getBalance();
22
- $.log.debug('当前余额', balance);
23
- var hex = mm.toHex({name:12});
24
- $.log.debug('对象转哈希', hex);
25
-
26
- var obj = mm.toObj(hex);
27
- $.log.debug('哈希转对象', obj);
28
- $.log.debug(mm.toHash("666"));
29
- }
30
-
31
- test();
package/demo/test.js DELETED
@@ -1,65 +0,0 @@
1
- var mm_contract = require('../index.js');
2
- // var abi = require('./nft-abi.js');
3
- var abi = require('./test_abi.js');
4
-
5
- /**
6
- * 调用合约所需配置
7
- * @property {String} contract_address 合约地址
8
- * @property {String} user_address 用户地址
9
- */
10
- var config = {
11
- // chain: "HT",
12
- contract_address: "0xfe25A97B5E3257e6e7164Ede813C3d4FBb1C2e3b",
13
- account_address: "0x87e73A055000F0D1B8c47A8A9a0431245e3Baaa1",
14
- host: "https://ropsten.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161",
15
- chainId: 3,
16
- abi
17
- };
18
-
19
- /**
20
- * 测试方法
21
- */
22
- async function test() {
23
- var mm = new mm_contract(config);
24
- var web3 = mm.init();
25
-
26
- // var contract = new web3.eth.Contract(abi, config.contract_address);
27
- // var ret = await contract.methods.getNFTsOf("0x87e73A055000F0D1B8c47A8A9a0431245e3Baaa1").call();
28
- // $.log.debug(ret);
29
-
30
- // var ret = await mm.call("getNFTsOf", "0x87e73A055000F0D1B8c47A8A9a0431245e3Baaa1");
31
- // $.log.debug(ret);
32
- var balance = await mm.getBalance("0x87e73A055000F0D1B8c47A8A9a0431245e3Baaa1");
33
- $.log.debug(balance);
34
-
35
- var balance = await mm.call("balanceOf", "0x87e73A055000F0D1B8c47A8A9a0431245e3Baaa1");
36
- $.log.debug(balance);
37
-
38
- // var ret_post = await mm.send("approve", "0xfe25A97B5E3257e6e7164Ede813C3d4FBb1C2e3b", 1000000000000000);
39
- // $.log.debug(ret_post);
40
- // $.log.debug(contract.methods.balanceOf("0x87e73A055000F0D1B8c47A8A9a0431245e3Baaa1").call());
41
- // var chain = contract.at(config.contract_address);
42
- // $.log.debug(chain);
43
- // var account_one = web3.eth.accounts[0];
44
- // $.log.debug(account_one);
45
- // var balance = await contract.methods.balanceOf("0x87e73A055000F0D1B8c47A8A9a0431245e3Baaa1").call({
46
- // from: "0x87e73A055000F0D1B8c47A8A9a0431245e3Baaa1"
47
- // });
48
- // $.log.debug(balance);
49
- // var nft_info = await contract.methods.getNFTsOf("0x87e73A055000F0D1B8c47A8A9a0431245e3Baaa1").call({
50
- // from: "0x87e73A055000F0D1B8c47A8A9a0431245e3Baaa1"
51
- // });
52
- // $.log.debug(nft_info);
53
-
54
- // // 查询余额
55
- // var balance = await mm.getBalance();
56
- // $.log.debug('当前余额', balance);
57
- // var hex = mm.toHex({name:12});
58
- // $.log.debug('对象转哈希', hex);
59
-
60
- // var obj = mm.toObj(hex);
61
- // $.log.debug('哈希转对象', obj);
62
- // $.log.debug(mm.toHash("666"));
63
- }
64
-
65
- test();