Compare commits
354 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
1823fb575d | ||
![]() |
4de6776eb3 | ||
![]() |
cb6c257e9e | ||
![]() |
04681df049 | ||
![]() |
56d9c17bc8 | ||
![]() |
52976493f0 | ||
![]() |
6f8c5b62b7 | ||
![]() |
0e60c39202 | ||
![]() |
d455ea207b | ||
![]() |
c00a42feb0 | ||
![]() |
d75c4b1ef6 | ||
![]() |
df1ec71ac8 | ||
![]() |
4bd46cb11d | ||
![]() |
41b51aef24 | ||
![]() |
a2edcaa8c8 | ||
![]() |
e9d97f1cd4 | ||
![]() |
cc7a1363de | ||
![]() |
ce2618ad0a | ||
![]() |
c942261656 | ||
![]() |
c14cdd4737 | ||
![]() |
38c5050ba1 | ||
![]() |
a8d8730c04 | ||
![]() |
6d073b7b62 | ||
![]() |
07a77d6bb3 | ||
![]() |
daa393f51c | ||
![]() |
59c011dbc7 | ||
![]() |
b9c0d1c462 | ||
![]() |
ef0bcff811 | ||
![]() |
97b8e8ff8f | ||
![]() |
56b1fb19c3 | ||
![]() |
df39099603 | ||
![]() |
4ae40fbd5f | ||
![]() |
9b55445dc8 | ||
![]() |
f5a1a84d11 | ||
![]() |
da3f90c391 | ||
![]() |
b71fe9c21e | ||
![]() |
cf8d6156df | ||
![]() |
02faaf2fb6 | ||
![]() |
7fcf0c6e4b | ||
![]() |
38e9e0bf80 | ||
![]() |
bb052f7c70 | ||
![]() |
e7e838253e | ||
![]() |
d2443a055a | ||
![]() |
4589e44839 | ||
![]() |
2eb8aceec8 | ||
![]() |
72fbc76c78 | ||
![]() |
63d5a737ed | ||
![]() |
2e755d0077 | ||
![]() |
e5f063831e | ||
![]() |
60ccb4159e | ||
![]() |
d000729ada | ||
![]() |
c976b7b5ce | ||
![]() |
05fa656683 | ||
![]() |
7d6e7aa3d5 | ||
![]() |
fe56886c55 | ||
![]() |
9f297f5aab | ||
![]() |
96f8e716fc | ||
![]() |
3a8cdfd4eb | ||
![]() |
7fb9b5a357 | ||
![]() |
a5a07f5cf3 | ||
![]() |
b8582bcd58 | ||
![]() |
75a3064dc9 | ||
![]() |
efbda5e2a0 | ||
![]() |
4038b92b63 | ||
![]() |
e68464adec | ||
![]() |
2a0e235d7b | ||
![]() |
99b41d0e22 | ||
![]() |
eade3fae08 | ||
![]() |
680092d6dd | ||
![]() |
eb9595ecbc | ||
![]() |
27652ca814 | ||
![]() |
05c94a914d | ||
![]() |
d9c4d4fd43 | ||
![]() |
26d7ccab70 | ||
![]() |
e2b1e8e744 | ||
![]() |
7188505572 | ||
![]() |
e22e831ecd | ||
![]() |
91b8017b93 | ||
![]() |
eb9c098438 | ||
![]() |
ec4eb15917 | ||
![]() |
aa39e080f6 | ||
![]() |
68b88be7cc | ||
![]() |
b31062175d | ||
![]() |
18615d0af0 | ||
![]() |
d3bafebdb6 | ||
![]() |
a529a23b04 | ||
![]() |
9813735a64 | ||
![]() |
a1ed6c4b12 | ||
![]() |
e0d55b22ff | ||
![]() |
25bb1591f7 | ||
![]() |
2b88dde6d6 | ||
![]() |
43343faa4b | ||
![]() |
629caa7dda | ||
![]() |
cc65e6f689 | ||
![]() |
6b7d62f4cb | ||
![]() |
f4410a4736 | ||
![]() |
ffa9fb602c | ||
![]() |
093c387e61 | ||
![]() |
d3c75063f1 | ||
![]() |
68d8f74c19 | ||
![]() |
981be683cc | ||
![]() |
310f734e8f | ||
![]() |
6e6f84b474 | ||
![]() |
25335b5abf | ||
![]() |
83ad67f2a5 | ||
![]() |
de29d059a6 | ||
![]() |
724f940c99 | ||
![]() |
34e57e1810 | ||
![]() |
5a706cdfff | ||
![]() |
f3c08b73b2 | ||
![]() |
74606a70e9 | ||
![]() |
6cc9017e35 | ||
![]() |
86370eb461 | ||
![]() |
3a38f864f6 | ||
![]() |
7d58ed97b2 | ||
![]() |
f6eac91448 | ||
![]() |
b4db71543b | ||
![]() |
22772b6e86 | ||
![]() |
ca83c4f9c0 | ||
![]() |
7e8c95636f | ||
![]() |
26c2bae64d | ||
![]() |
124269c6ab | ||
![]() |
524850ec00 | ||
![]() |
f9704bab9d | ||
![]() |
7c24a8a2b5 | ||
![]() |
da65418be2 | ||
![]() |
d4fe0dee7e | ||
![]() |
44a7766427 | ||
![]() |
a4425214eb | ||
![]() |
ac4b287bdd | ||
![]() |
ae3d3d1344 | ||
![]() |
799f70d63c | ||
![]() |
bc3a0af938 | ||
![]() |
8f9bdcf52c | ||
![]() |
6b5d3d44da | ||
![]() |
46a114bc20 | ||
![]() |
a1d127152c | ||
![]() |
b70988c946 | ||
![]() |
9bcaa250b6 | ||
![]() |
11ac3f4957 | ||
![]() |
7dff7ce980 | ||
![]() |
4b4f94e6fd | ||
![]() |
f681c24e5b | ||
![]() |
15715d28cf | ||
![]() |
3c53269ca2 | ||
![]() |
b399e1ed4a | ||
![]() |
4457cd800c | ||
![]() |
4ad49a4409 | ||
![]() |
92502755be | ||
![]() |
3982eea8c7 | ||
![]() |
6dd7a4ed0c | ||
![]() |
b1d6322a07 | ||
![]() |
0179f1fa96 | ||
![]() |
65bc26ed3f | ||
![]() |
0672798d64 | ||
![]() |
c33b30580c | ||
![]() |
7a4d4f4b1b | ||
![]() |
71f4d9d6b1 | ||
![]() |
1a8f90a5e5 | ||
![]() |
6f2cd47476 | ||
![]() |
639f5e0a9e | ||
![]() |
55dccca73c | ||
![]() |
d976d792a1 | ||
![]() |
e3488bf9e0 | ||
![]() |
4eb341e815 | ||
![]() |
ac9c4fd56d | ||
![]() |
987cdf1979 | ||
![]() |
6396c2b01a | ||
![]() |
2597cd0b2c | ||
![]() |
1d1ebca377 | ||
![]() |
b85a05cc20 | ||
![]() |
06da2ac759 | ||
![]() |
9847e3cc21 | ||
![]() |
7644281227 | ||
![]() |
d205b39930 | ||
![]() |
bcdfbb107f | ||
![]() |
b323031a12 | ||
![]() |
8356f5ed5f | ||
![]() |
330c4f92c6 | ||
![]() |
fd1233f042 | ||
![]() |
6610f054c0 | ||
![]() |
6732f4c0f1 | ||
![]() |
9d36ba06ca | ||
![]() |
0faffa2863 | ||
![]() |
93bffca53e | ||
![]() |
6c04dfb543 | ||
![]() |
66a8fc4852 | ||
![]() |
164d68a484 | ||
![]() |
b29c4e55ba | ||
![]() |
cf5e3ba95d | ||
![]() |
467ba45f59 | ||
![]() |
0d042d5189 | ||
![]() |
2ef71a1961 | ||
![]() |
c79c6223b4 | ||
![]() |
d870ccfcc4 | ||
![]() |
6429156822 | ||
![]() |
d1c2a9ac65 | ||
![]() |
0530906099 | ||
![]() |
de925ce596 | ||
![]() |
3b36b36eb0 | ||
![]() |
2ca64a7396 | ||
![]() |
ca67d99e8f | ||
![]() |
4610584f70 | ||
![]() |
8206fd760a | ||
![]() |
816669b984 | ||
![]() |
d43d189592 | ||
![]() |
64fa8dd4c4 | ||
![]() |
8c4cb553fa | ||
![]() |
946dd73e73 | ||
![]() |
a912c1fe61 | ||
![]() |
0ebe520fcf | ||
![]() |
a45f6cb4d3 | ||
![]() |
74d07939c0 | ||
![]() |
eaa99ff0f8 | ||
![]() |
cb89444c2a | ||
![]() |
c0d89bd21f | ||
![]() |
0077418819 | ||
![]() |
68c14703e4 | ||
![]() |
4b9a0e8acb | ||
![]() |
1e88d573d3 | ||
![]() |
e8fc2d9c88 | ||
![]() |
afcc0bf42c | ||
![]() |
c009eab0d6 | ||
![]() |
c4dd560aa3 | ||
![]() |
33a3450bc1 | ||
![]() |
6d0c5521a6 | ||
![]() |
e087402927 | ||
![]() |
2d9c8ba3af | ||
![]() |
c8b0e9b5d8 | ||
![]() |
bf1be4dfe0 | ||
![]() |
8d532cc92e | ||
![]() |
b1661863b4 | ||
![]() |
e54d6eabe3 | ||
![]() |
e445febe4b | ||
![]() |
8104042a4c | ||
![]() |
ba8e204044 | ||
![]() |
1220c32c3a | ||
![]() |
b4d4eb2882 | ||
![]() |
e0e11a7a4b | ||
![]() |
5df6cc5635 | ||
![]() |
4d1877bdb2 | ||
![]() |
900427cbc9 | ||
![]() |
747d5aa207 | ||
![]() |
6716c36eb0 | ||
![]() |
749349ae76 | ||
![]() |
c769d11fda | ||
![]() |
9500eb815d | ||
![]() |
2fe89f5304 | ||
![]() |
dc2f8e1af3 | ||
![]() |
d3d481fb53 | ||
![]() |
d7cdb16d4c | ||
![]() |
f5c88d4669 | ||
![]() |
91ed51c834 | ||
![]() |
1e7552dfd6 | ||
![]() |
366aa35daf | ||
![]() |
a132dddf4d | ||
![]() |
ddc8429e9f | ||
![]() |
a2b818d98a | ||
![]() |
9f28c4ff8c | ||
![]() |
439a1106b3 | ||
![]() |
ae2a6ddd5e | ||
![]() |
43a2cdd55c | ||
![]() |
f14881b9e4 | ||
![]() |
2af426443a | ||
![]() |
3aa924fba8 | ||
![]() |
24b082b839 | ||
![]() |
1a96dac98f | ||
![]() |
5e9ca195e9 | ||
![]() |
8a44e5da5e | ||
![]() |
e40181d6b0 | ||
![]() |
ae8ab187e1 | ||
![]() |
88004133ee | ||
![]() |
f2aea33b9c | ||
![]() |
6868d11062 | ||
![]() |
bc3df5383b | ||
![]() |
e584bbf712 | ||
![]() |
a56011d394 | ||
![]() |
3a60f9111b | ||
![]() |
fdc8e98ed2 | ||
![]() |
7014746a60 | ||
![]() |
53490821b3 | ||
![]() |
492beda405 | ||
![]() |
a25674c758 | ||
![]() |
455ec2fb8d | ||
![]() |
7883a066b9 | ||
![]() |
e0e62c5252 | ||
![]() |
538bcffb44 | ||
![]() |
4d48b3df39 | ||
![]() |
7c265ec2ad | ||
![]() |
9269de9a0b | ||
![]() |
1802e72a56 | ||
![]() |
9416799e35 | ||
![]() |
fa6af8b1e7 | ||
![]() |
bd152be292 | ||
![]() |
222fa3429b | ||
![]() |
8d449b5aaf | ||
![]() |
1f8d3943bd | ||
![]() |
c5cefb2b10 | ||
![]() |
4b256a30a1 | ||
![]() |
6a4fab049e | ||
![]() |
d3170e6337 | ||
![]() |
1b6b3488ad | ||
![]() |
18c398ce4d | ||
![]() |
577cb37723 | ||
![]() |
873c6a77cd | ||
![]() |
36e03d6863 | ||
![]() |
4d1d884c19 | ||
![]() |
cc37aca382 | ||
![]() |
cb1183a5ed | ||
![]() |
427ca61d7a | ||
![]() |
8eeff734be | ||
![]() |
46b41f8063 | ||
![]() |
287ff2ad71 | ||
![]() |
0121f5e1e9 | ||
![]() |
35dd72e093 | ||
![]() |
715ec01110 | ||
![]() |
63eda1f879 | ||
![]() |
90c5a53dba | ||
![]() |
2bd2df4fab | ||
![]() |
0aff913c1a | ||
![]() |
da75ada612 | ||
![]() |
59e43a2cdd | ||
![]() |
6a5e6223ea | ||
![]() |
f3533d7901 | ||
![]() |
18b07df824 | ||
![]() |
a8aba49eb1 | ||
![]() |
068514027f | ||
![]() |
ccfa3b599e | ||
![]() |
69e80fcd14 | ||
![]() |
769f860524 | ||
![]() |
06c00e8a9a | ||
![]() |
df47209118 | ||
![]() |
e038fd28ec | ||
![]() |
69f806ed68 | ||
![]() |
010550f13e | ||
![]() |
cab8147872 | ||
![]() |
339e062b86 | ||
![]() |
9fa16f02fb | ||
![]() |
14d8563995 | ||
![]() |
323d708d09 | ||
![]() |
a474382f31 | ||
![]() |
0b53a086b0 | ||
![]() |
1ec2178fc9 | ||
![]() |
f26f278cec | ||
![]() |
7face64d01 | ||
![]() |
355316350b | ||
![]() |
e6351d02b1 | ||
![]() |
1d63826bb5 | ||
![]() |
05e1605c69 | ||
![]() |
a261563e36 | ||
![]() |
ef135fafc7 | ||
![]() |
8da2c639ad | ||
![]() |
b5ac4c6cc9 | ||
![]() |
5ad8d77a70 |
27
.env.dev
@ -1,4 +1,29 @@
|
||||
VUE_APP_BASE_API='https://market.cebg.games'
|
||||
VUE_APP_BASE_API2='https://invitation.counterfire.games'
|
||||
//VUE_APP_BASE_API2='http://192.168.100.83:3000/'
|
||||
VUE_APP_GPAL_API='https://game2006api.cebggame.com/'
|
||||
VUE_APP_GPAL_API='https://game2006sapi.cebggame.com/'
|
||||
# VUE_APP_PASSPORT_PUBLISHABLE_KEY=pk_imapik-test-8c2FAlWxWAoRITk1v9rH
|
||||
VUE_APP_PASSPORT_PUBLISHABLE_KEY=pk_imapik-test-eRr-kyOKaZ0jIdrvrPCn
|
||||
VUE_APP_PASSPORT_REDIRECT_URI=http://localhost:4000
|
||||
VUE_APP_PASSPORT_LOGOUT_URI=http://localhost:4000
|
||||
# VUE_APP_PASSPORT_CLIENT_ID=eTmUah69p7ZdRhRYzBta6lZRKXXeXDYj
|
||||
VUE_APP_PASSPORT_CLIENT_ID=0FNfXxQywm7wjdbyLTDzWt4txc53yRrT
|
||||
VUE_APP_PASSPORT_MARKET_ADDRESS=0x7d117aA8BD6D31c4fa91722f246388f38ab1942c
|
||||
VUE_APP_UAW_API='https://oauth-svr.cebggame.com/task'
|
||||
VUE_APP_MKT_API='https://market-test.kingsome.cn'
|
||||
VUE_APP_REWARD_API='https://game2006api-test.kingsome.cn'
|
||||
VUE_APP_NET_ID='13473'
|
||||
VUE_APP_MARKET_CURRENCY='0xFd42bfb03212dA7e1A4608a44d7658641D99CF34'
|
||||
VUE_APP_MAKEFEE_ADDRESS='0x50A8e60041A206AcaA5F844a1104896224be6F39'
|
||||
VUE_APP_LOCKER_ADDRESS='0xC8607507451059CfAe6Ca4D07EC6f631ce8ef9f9'
|
||||
VUE_APP_FOUNDER_ADDRESS='0x7f2b4db626d878778e178b4f0c7ba3a2870c6dd0'
|
||||
VUE_APP_EXPLORER_URL='https://explorer.testnet.immutable.com'
|
||||
VUE_APP_PRODUCTION=sandbox
|
||||
|
||||
VUE_APP_LOGIN_API='https://login-test.kingsome.cn'
|
||||
|
||||
VUE_APP_NET_ID_MAIN='11155111'
|
||||
VUE_APP_LOCKER_ADDRESS_MAIN='0x7F2b4DB626d878778e178B4F0C7bA3a2870C6dd0'
|
||||
|
||||
VUE_APP_STAKING_CHAIN='97'
|
||||
VUE_APP_NET_ID_CLAIM='97'
|
||||
|
@ -1,2 +1,29 @@
|
||||
VUE_APP_BASE_API='https://market.cebg.games'
|
||||
VUE_APP_GPAL_API='http://192.168.100.83:4000/sns'
|
||||
VUE_APP_BASE_API2='https://invitation.counterfire.games'
|
||||
//VUE_APP_BASE_API2='http://192.168.100.83:3000/'
|
||||
VUE_APP_GPAL_API='https://game2006sapi.cebggame.com/'
|
||||
# VUE_APP_PASSPORT_PUBLISHABLE_KEY=pk_imapik-test-8c2FAlWxWAoRITk1v9rH
|
||||
VUE_APP_PASSPORT_PUBLISHABLE_KEY=pk_imapik-test-eRr-kyOKaZ0jIdrvrPCn
|
||||
VUE_APP_PASSPORT_REDIRECT_URI=https://market.kingsome.cn
|
||||
VUE_APP_PASSPORT_LOGOUT_URI=https://market.kingsome.cn
|
||||
# VUE_APP_PASSPORT_CLIENT_ID=eTmUah69p7ZdRhRYzBta6lZRKXXeXDYj
|
||||
VUE_APP_PASSPORT_CLIENT_ID=0FNfXxQywm7wjdbyLTDzWt4txc53yRrT
|
||||
VUE_APP_PASSPORT_MARKET_ADDRESS=0x7d117aA8BD6D31c4fa91722f246388f38ab1942c
|
||||
VUE_APP_UAW_API='https://oauth-svr.cebggame.com/task'
|
||||
VUE_APP_MKT_API='https://market-test.kingsome.cn'
|
||||
VUE_APP_REWARD_API='https://game2006api-test.kingsome.cn'
|
||||
VUE_APP_NET_ID='13473'
|
||||
VUE_APP_MARKET_CURRENCY='0xFd42bfb03212dA7e1A4608a44d7658641D99CF34'
|
||||
VUE_APP_MAKEFEE_ADDRESS='0x50A8e60041A206AcaA5F844a1104896224be6F39'
|
||||
VUE_APP_LOCKER_ADDRESS='0xC8607507451059CfAe6Ca4D07EC6f631ce8ef9f9'
|
||||
VUE_APP_FOUNDER_ADDRESS='0x7f2b4db626d878778e178b4f0c7ba3a2870c6dd0'
|
||||
VUE_APP_EXPLORER_URL='https://explorer.testnet.immutable.com'
|
||||
VUE_APP_PRODUCTION=sandbox
|
||||
|
||||
VUE_APP_LOGIN_API='https://login-test.kingsome.cn'
|
||||
|
||||
VUE_APP_NET_ID_MAIN='11155111'
|
||||
VUE_APP_LOCKER_ADDRESS_MAIN='0x7F2b4DB626d878778e178B4F0C7bA3a2870C6dd0'
|
||||
|
||||
VUE_APP_STAKING_CHAIN='97'
|
||||
VUE_APP_NET_ID_CLAIM='97'
|
||||
|
@ -1,4 +1,29 @@
|
||||
VUE_APP_BASE_API='https://market.cebg.games'
|
||||
VUE_APP_BASE_API2='https://invitation.counterfire.games'
|
||||
//VUE_APP_BASE_API2='http://192.168.100.83:3000/'
|
||||
VUE_APP_GPAL_API='https://game2006api.cebggame.com/'
|
||||
VUE_APP_GPAL_API='https://game2006api.cebggame.com/'
|
||||
# VUE_APP_PASSPORT_PUBLISHABLE_KEY=pk_imapik-test-8c2FAlWxWAoRITk1v9rH
|
||||
VUE_APP_PASSPORT_PUBLISHABLE_KEY=pk_imapik-tU10buLqoyLZ0o54rcub
|
||||
VUE_APP_PASSPORT_REDIRECT_URI=https://www.counterfire.games
|
||||
VUE_APP_PASSPORT_LOGOUT_URI=https://www.counterfire.games
|
||||
VUE_APP_PASSPORT_CLIENT_ID=tTB5eEedqDOHPHMI41sRDGmqAQwus9oE
|
||||
# VUE_APP_PASSPORT_CLIENT_ID=0FNfXxQywm7wjdbyLTDzWt4txc53yRrT
|
||||
VUE_APP_PASSPORT_MARKET_ADDRESS=0x7d117aA8BD6D31c4fa91722f246388f38ab1942c
|
||||
VUE_APP_UAW_API='https://taskapi.cebggame.com'
|
||||
VUE_APP_MKT_API='https://market-api.counterfire.games'
|
||||
VUE_APP_REWARD_API='https://game2006api-test.kingsome.cn'
|
||||
VUE_APP_NET_ID='13371'
|
||||
VUE_APP_MARKET_CURRENCY='0x52A6c53869Ce09a731CD772f245b97A4401d3348'
|
||||
VUE_APP_MAKEFEE_ADDRESS='0x50A8e60041A206AcaA5F844a1104896224be6F39'
|
||||
VUE_APP_LOCKER_ADDRESS='0x2034e51e1a24f8b488610aBBDCc74F3e0cA833df'
|
||||
VUE_APP_FOUNDER_ADDRESS='0x5c16AC8322E5cac8ad235F7e0Dc5d23bffe3ed50'
|
||||
VUE_APP_EXPLORER_URL='https://explorer.immutable.com'
|
||||
VUE_APP_PRODUCTION=production
|
||||
|
||||
VUE_APP_LOGIN_API='https://login-test.cebggame.com'
|
||||
|
||||
VUE_APP_NET_ID_MAIN='1'
|
||||
VUE_APP_LOCKER_ADDRESS_MAIN='0x5c16AC8322E5cac8ad235F7e0Dc5d23bffe3ed50'
|
||||
|
||||
VUE_APP_STAKING_CHAIN='56'
|
||||
VUE_APP_NET_ID_CLAIM='56'
|
||||
|
30
.env.test
Normal file
@ -0,0 +1,30 @@
|
||||
VUE_APP_BASE_API='https://market.cebg.games'
|
||||
VUE_APP_BASE_API2='https://invitation.counterfire.games'
|
||||
//VUE_APP_BASE_API2='http://192.168.100.83:3000/'
|
||||
VUE_APP_GPAL_API='https://game2006api.cebggame.com/'
|
||||
# VUE_APP_PASSPORT_PUBLISHABLE_KEY=pk_imapik-test-8c2FAlWxWAoRITk1v9rH
|
||||
VUE_APP_PASSPORT_PUBLISHABLE_KEY=pk_imapik-tU10buLqoyLZ0o54rcub
|
||||
VUE_APP_PASSPORT_REDIRECT_URI=https://www.counterfire.games
|
||||
VUE_APP_PASSPORT_LOGOUT_URI=https://www.counterfire.games
|
||||
VUE_APP_PASSPORT_CLIENT_ID=tTB5eEedqDOHPHMI41sRDGmqAQwus9oE
|
||||
# VUE_APP_PASSPORT_CLIENT_ID=0FNfXxQywm7wjdbyLTDzWt4txc53yRrT
|
||||
VUE_APP_PASSPORT_MARKET_ADDRESS=0x7d117aA8BD6D31c4fa91722f246388f38ab1942c
|
||||
VUE_APP_UAW_API='https://taskapi.cebggame.com'
|
||||
VUE_APP_MKT_API='https://market-api.counterfire.games'
|
||||
VUE_APP_REWARD_API='https://game2006api-test.kingsome.cn'
|
||||
VUE_APP_NET_ID='13371'
|
||||
VUE_APP_MARKET_CURRENCY='0x52A6c53869Ce09a731CD772f245b97A4401d3348'
|
||||
VUE_APP_MAKEFEE_ADDRESS='0x50A8e60041A206AcaA5F844a1104896224be6F39'
|
||||
VUE_APP_LOCKER_ADDRESS='0x2034e51e1a24f8b488610aBBDCc74F3e0cA833df'
|
||||
VUE_APP_FOUNDER_ADDRESS='0x5c16AC8322E5cac8ad235F7e0Dc5d23bffe3ed50'
|
||||
VUE_APP_EXPLORER_URL='https://explorer.immutable.com'
|
||||
VUE_APP_PRODUCTION=production
|
||||
|
||||
VUE_APP_LOGIN_API='https://login-test.cebggame.com'
|
||||
|
||||
|
||||
VUE_APP_NET_ID_MAIN='1'
|
||||
VUE_APP_LOCKER_ADDRESS_MAIN='0x5c16AC8322E5cac8ad235F7e0Dc5d23bffe3ed50'
|
||||
|
||||
VUE_APP_STAKING_CHAIN='56'
|
||||
VUE_APP_NET_ID_CLAIM='56'
|
1
.gitignore
vendored
@ -12,4 +12,5 @@ yarn-error.log*
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
dist*
|
||||
|
||||
|
5
.prettierignore
Normal file
@ -0,0 +1,5 @@
|
||||
node_modules
|
||||
artifacts
|
||||
cache
|
||||
coverage*
|
||||
gasReporterOutput.json
|
8
.prettierrc
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"printWidth": 120,
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"singleQuote": false,
|
||||
"bracketSpacing": false,
|
||||
"explicitTypes": "always"
|
||||
}
|
@ -2,6 +2,7 @@
|
||||
npm run dev
|
||||
yarn run dev
|
||||
|
||||
|
||||
## install 修改
|
||||
node_modules\@uniswap\router-sdk\dist\router-sdk.cjs.production.min.js r.BigInt(五个全部替换) 替换成 r.default.BigInt
|
||||
|
||||
|
||||
|
77
components.d.ts
vendored
Normal file
@ -0,0 +1,77 @@
|
||||
/* eslint-disable */
|
||||
// @ts-nocheck
|
||||
// Generated by unplugin-vue-components
|
||||
// Read more: https://github.com/vuejs/core/pull/3399
|
||||
export {}
|
||||
|
||||
/* prettier-ignore */
|
||||
declare module 'vue' {
|
||||
export interface GlobalComponents {
|
||||
AboutFooter: typeof import('./src/components/about/AboutFooter.vue')['default']
|
||||
AButton: typeof import('ant-design-vue/es')['Button']
|
||||
ACheckboxGroup: typeof import('ant-design-vue/es')['CheckboxGroup']
|
||||
ACollapse: typeof import('ant-design-vue/es')['Collapse']
|
||||
ACollapsePanel: typeof import('ant-design-vue/es')['CollapsePanel']
|
||||
AInput: typeof import('ant-design-vue/es')['Input']
|
||||
AModal: typeof import('ant-design-vue/es')['Modal']
|
||||
ARadio: typeof import('ant-design-vue/es')['Radio']
|
||||
ARadioGroup: typeof import('ant-design-vue/es')['RadioGroup']
|
||||
ASelect: typeof import('ant-design-vue/es')['Select']
|
||||
ASpace: typeof import('ant-design-vue/es')['Space']
|
||||
AssetsContent: typeof import('./src/components/assets/assetsContent.vue')['default']
|
||||
AssetsHeader: typeof import('./src/components/assets/assetsHeader.vue')['default']
|
||||
ATable: typeof import('ant-design-vue/es')['Table']
|
||||
ATableColumn: typeof import('ant-design-vue/es')['TableColumn']
|
||||
Banner: typeof import('./src/components/home/banner.vue')['default']
|
||||
BuyDialog: typeof import('./src/components/Dialogs/buyDialog.vue')['default']
|
||||
Card: typeof import('./src/components/common/card.vue')['default']
|
||||
Cart: typeof import('./src/components/cart/index.vue')['default']
|
||||
ChainModel: typeof import('./src/components/home/ChainModel.vue')['default']
|
||||
ChainSelectModel: typeof import('./src/components/chain/ChainSelectModel.vue')['default']
|
||||
ChipCard: typeof import('./src/components/home/ChipCard.vue')['default']
|
||||
Collectibles: typeof import('./src/components/assets/collectibles.vue')['default']
|
||||
ConfirmDialog: typeof import('./src/components/Dialogs/confirmDialog.vue')['default']
|
||||
GameFeatures: typeof import('./src/components/home/GameFeatures.vue')['default']
|
||||
GameVideo: typeof import('./src/components/home/GameVideo.vue')['default']
|
||||
Gold: typeof import('./src/components/common/searchView/gold.vue')['default']
|
||||
Hanging: typeof import('./src/components/assets/hanging.vue')['default']
|
||||
HangingCard: typeof import('./src/components/common/hangingCard.vue')['default']
|
||||
Hero: typeof import('./src/components/common/searchView/hero.vue')['default']
|
||||
HeroCard: typeof import('./src/components/home/HeroCard.vue')['default']
|
||||
HeroWeaponChipSelector: typeof import('./src/components/home/HeroWeaponChipSelector.vue')['default']
|
||||
HomeFooter: typeof import('./src/components/home/HomeFooter.vue')['default']
|
||||
ImageTextModal: typeof import('./src/components/global/ImageTextModal.vue')['default']
|
||||
ImgCard: typeof import('./src/components/common/imgCard.vue')['default']
|
||||
IntroductionBanner: typeof import('./src/components/about/IntroductionBanner.vue')['default']
|
||||
LatestNew: typeof import('./src/components/about/LatestNew.vue')['default']
|
||||
Layout: typeof import('./src/components/layout/index.vue')['default']
|
||||
LoadingDialog: typeof import('./src/components/Dialogs/loadingDialog.vue')['default']
|
||||
MktContent: typeof import('./src/components/marketplace/mktContent.vue')['default']
|
||||
MktHeader: typeof import('./src/components/marketplace/mktHeader.vue')['default']
|
||||
MyCard: typeof import('./src/components/assets/myCard.vue')['default']
|
||||
NavBar: typeof import('./src/components/layout/NavBar.vue')['default']
|
||||
Navber: typeof import('./src/components/layout/navber.vue')['default']
|
||||
Notification: typeof import('./src/components/global/Notification.vue')['default']
|
||||
Overview: typeof import('./src/components/common/searchView/Overview.vue')['default']
|
||||
Please: typeof import('./src/components/global/Please.vue')['default']
|
||||
Price: typeof import('./src/components/common/searchView/Price.vue')['default']
|
||||
Rank: typeof import('./src/components/common/searchView/rank.vue')['default']
|
||||
Roadmap: typeof import('./src/components/about/Roadmap.vue')['default']
|
||||
RouterLink: typeof import('vue-router')['RouterLink']
|
||||
RouterView: typeof import('vue-router')['RouterView']
|
||||
SellDialog: typeof import('./src/components/Dialogs/sellDialog.vue')['default']
|
||||
Sort: typeof import('./src/components/common/searchView/Sort.vue')['default']
|
||||
StarTimer: typeof import('./src/components/common/starTimer.vue')['default']
|
||||
Status: typeof import('./src/components/common/searchView/status.vue')['default']
|
||||
StatusRadio: typeof import('./src/components/common/searchView/statusRadio.vue')['default']
|
||||
TeamMember: typeof import('./src/components/about/TeamMember.vue')['default']
|
||||
TeamVision: typeof import('./src/components/about/TeamVision.vue')['default']
|
||||
Trading: typeof import('./src/components/assets/trading.vue')['default']
|
||||
TradingCard: typeof import('./src/components/common/tradingCard.vue')['default']
|
||||
WalletSelectModel: typeof import('./src/components/chain/WalletSelectModel.vue')['default']
|
||||
WeaponCard: typeof import('./src/components/home/WeaponCard.vue')['default']
|
||||
WeaponModelLoader: typeof import('./src/components/home/WeaponModelLoader.vue')['default']
|
||||
WhatCounterFire: typeof import('./src/components/home/WhatCounterFire.vue')['default']
|
||||
YouTubeVideoDemo: typeof import('./src/components/global/YouTubeVideoDemo.vue')['default']
|
||||
}
|
||||
}
|
73
index.html
@ -5,34 +5,37 @@
|
||||
<link rel="icon" href="/logo.png" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Counter Fire</title>
|
||||
<meta property="og:title" content="Counter Fire" />
|
||||
<meta property="og:title" content="Pre-Deposit is now live!" />
|
||||
<meta
|
||||
property="og:description"
|
||||
content="Counter Fire.counterFire.games | Counter Fire is blinking! Quest and Rewards.Join Counter Fire and Rise of Planet. Get your Planet and rewards. A new evolution about Web3Gaming."
|
||||
content="P2E Season 1 is set to launch with a bang! Gear up, warriors,CounterFire is heating up."
|
||||
/>
|
||||
<meta
|
||||
name="description"
|
||||
content="Counter Fire.counterFire.games | Counter Fire is blinking! Quest and Rewards.Join Counter Fire and Rise of Planet. Get your Planet and rewards. A new evolution about Web3Gaming."
|
||||
content="P2E Season 1 is set to launch with a bang! Gear up, warriors,CounterFire is heating up."
|
||||
/>
|
||||
<meta
|
||||
name="keywords"
|
||||
content="CounterFire;CF;Gamefi;Web3;web3gaming; Cf game;Cf mobile; CounterFire googleplay; CounterFire Appstore;
|
||||
battle royale;token;airdrop;p2e; play to earn, free to play, blockchain game;Arbitrum game;Arbitrum. Cryptocurrency; Crypto;anime game;anime web3 game;Two-dimensional game;shooting game;Anime shooting mobile game"
|
||||
content="CounterFire; CF; Gamefi; Web3; web3gaming; Cf game;Cf mobile; CounterFire googleplay; CounterFire Appstore;
|
||||
battle royale;token;airdrop;p2e; play to earn, free to play, blockchain game;Arbitrum game;Arbitrum. Cryptocurrency; Crypto; anime game; anime web3 game; Two-dimensional game; shooting game; Anime shooting mobile game"
|
||||
/>
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:url" content="https://gacha.counterfire.games/" />
|
||||
<!-- <meta property="og:type" content="website" /> -->
|
||||
<!-- <meta property="og:url" content="https://gacha.counterfire.games/" /> -->
|
||||
<meta
|
||||
property="og:image"
|
||||
content="https://gacha.counterfire.games/images/counter.png"
|
||||
content="https://counterfire.games/images/counter.jpg"
|
||||
/>
|
||||
<!-- <meta property="og:site_name" content="Counter Fire" /> -->
|
||||
<meta property="twitter:card" content="summary_large_image" />
|
||||
<meta property="twitter:title" content="Counter Fire" />
|
||||
<meta property="twitter:title" content="Pre-Deposit is now live!" />
|
||||
<meta
|
||||
property="twitter:image"
|
||||
content="https://gacha.counterfire.games/images/counter.png"
|
||||
content="https://counterfire.games/images/counter.jpg"
|
||||
/>
|
||||
</head>
|
||||
<script>
|
||||
window.process = { browser: true, env: { ENVIRONMENT: 'BROWSER' } };
|
||||
</script>
|
||||
<script type="module">
|
||||
import { Buffer } from "buffer";
|
||||
window.Buffer = Buffer;
|
||||
@ -54,5 +57,55 @@
|
||||
|
||||
gtag("config", "G-9WFW3HQTR8");
|
||||
</script>
|
||||
<script th:inline="javascript">
|
||||
/**
|
||||
* 加载外部js
|
||||
*/
|
||||
var loadSingleScript = function (sub) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let src = sub[0];
|
||||
console.log(`>> begin load script: ${src}`);
|
||||
var s = document.createElement('script');
|
||||
s.async = true;
|
||||
if (sub[1] == 1)s.type = 'module';
|
||||
// s.src = src + (src.indexOf("?") == -1 ? "?" : "&") + "t=" + Date.now();
|
||||
s.src =src;
|
||||
s.addEventListener('load', function () {
|
||||
console.log(`<< finish load script: ${src}`);
|
||||
s.parentNode.removeChild(s);
|
||||
s.removeEventListener('load', arguments.callee, false);
|
||||
resolve && resolve();
|
||||
}, false);
|
||||
document.body.appendChild(s);
|
||||
})
|
||||
};
|
||||
var scripts = [
|
||||
['/js-assets/scripts/libs/jcwallet.js'],
|
||||
['/js-assets/scripts/libs/main.js'],
|
||||
['/js-assets/scripts/libs/utils.js'],
|
||||
['/js-assets/scripts/libs/native_bridge.js', 1],
|
||||
['/js-assets/scripts/libs/main_native_inject.js'],
|
||||
['/js-assets/scripts/run_sample.js'],
|
||||
]
|
||||
|
||||
var loadScripts = async function (list, callback) {
|
||||
var loaded = 0;
|
||||
var loadNext = function () {
|
||||
return new Promise((resolve, reject) => {
|
||||
// list[loaded][0] = list[loaded][0] + (list[loaded][0].indexOf("?") == -1 ? "?" : "&") + "t=" + Date.now();
|
||||
loadSingleScript(list[loaded]).then(() => {
|
||||
loaded++;
|
||||
if (loaded >= list.length) {
|
||||
resolve();
|
||||
} else {
|
||||
return loadNext();
|
||||
}
|
||||
})
|
||||
})
|
||||
};
|
||||
loadNext();
|
||||
};
|
||||
loadScripts(scripts, ()=> {})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
22
jsconfig.json
Normal file
@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"module": "esnext",
|
||||
"baseUrl": "./",
|
||||
"moduleResolution": "node",
|
||||
"allowJs": true,
|
||||
"paths": {
|
||||
"@/*": [
|
||||
"src/*"
|
||||
]
|
||||
},
|
||||
"lib": [
|
||||
"esnext",
|
||||
"dom",
|
||||
"dom.iterable",
|
||||
"scripthost"
|
||||
]
|
||||
},
|
||||
"include": ["src/**/*"],
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
19633
package-lock.json
generated
23
package.json
@ -3,8 +3,12 @@
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"scripts": {
|
||||
"dev": "vite --host --mode dev",
|
||||
"build:dev": "vite build --mode dev",
|
||||
"task": "vite --host --mode dev",
|
||||
"test": "vite --host --mode test",
|
||||
"dev": "vite --host --mode development",
|
||||
"prod": "vite --host --mode production",
|
||||
"build:task": "vite build --mode dev",
|
||||
"build:dev": "vite build --mode development",
|
||||
"build:test": "vite build --mode test",
|
||||
"build:prod": "vite build --mode production"
|
||||
},
|
||||
@ -14,21 +18,24 @@
|
||||
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
|
||||
"@metamask/safe-event-emitter": "^2.0.0",
|
||||
"@vue/runtime-dom": "^3.2.47",
|
||||
"@vueuse/core": "^9.12.0",
|
||||
"@walletconnect/web3-provider": "^1.8.0",
|
||||
"animate.css": "^4.1.1",
|
||||
"ant-design-vue": "^3.2.15",
|
||||
"axios": "^1.3.3",
|
||||
"ant-design-vue": "^4.2.3",
|
||||
"axios": "^1.7.2",
|
||||
"buffer": "^6.0.3",
|
||||
"ethers": "^5.4",
|
||||
"gsap": "^3.11.5",
|
||||
"js-cookie": "^3.0.1",
|
||||
"moment": "^2.30.1",
|
||||
"normalize.css": "^8.0.1",
|
||||
"opensea": "^1.0.1",
|
||||
"pinia": "^2.0.30",
|
||||
"pinia-plugin-persistedstate": "^3.2.1",
|
||||
"postcss-px-to-viewport": "^1.1.1",
|
||||
"postcss-px-to-viewport-8-plugin": "^1.2.5",
|
||||
"prerender-spa-plugin-next": "^4.2.3",
|
||||
"process": "^0.11.10",
|
||||
"rollup-plugin-polyfill-node": "^0.12.0",
|
||||
"stream-browserify": "^3.0.0",
|
||||
"swiper": "^10.3.0",
|
||||
"three": "^0.155.0",
|
||||
"util": "^0.12.5",
|
||||
@ -47,6 +54,7 @@
|
||||
"youtube-player": "^5.6.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@imtbl/sdk": "^1.41.0",
|
||||
"@vitejs/plugin-vue": "^4.0.0",
|
||||
"autoprefixer": "^10.4.14",
|
||||
"eslint-config-prettier": "^8.6.0",
|
||||
@ -56,6 +64,9 @@
|
||||
"sass": "^1.58.1",
|
||||
"tailwindcss": "^3.3.1",
|
||||
"terser": "^5.16.3",
|
||||
"ts-node": "^10.9.2",
|
||||
"typescript": "^5.4.5",
|
||||
"unplugin-vue-components": "^0.27.0",
|
||||
"vite": "^4.1.0",
|
||||
"vite-plugin-prerender": "^1.0.8",
|
||||
"vite-plugin-require-transform": "^1.0.9"
|
||||
|
Before Width: | Height: | Size: 470 KiB After Width: | Height: | Size: 372 KiB |
48
public/js-assets/scripts/libs/apple.client.js
Normal file
@ -0,0 +1,48 @@
|
||||
const scripts = ['https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js'];
|
||||
const CLIENT_ID = 'wallet.counterfire.games';
|
||||
const REDIRECT_URI = `${location.origin}${location.pathname}`;
|
||||
|
||||
// Authorization scopes required by the API; multiple scopes can be included, separated by spaces.
|
||||
const SCOPES = 'name email';
|
||||
export class AppleClient {
|
||||
initClient() {
|
||||
let state = Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
|
||||
let nonce = Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
|
||||
AppleID.auth.init({
|
||||
clientId : CLIENT_ID,
|
||||
scope : SCOPES,
|
||||
redirectURI : REDIRECT_URI,
|
||||
state,
|
||||
nonce,
|
||||
usePopup : true
|
||||
});
|
||||
}
|
||||
async initAppleClient() {
|
||||
await loadScripts(scripts.map((script) => [script]));
|
||||
setInterval(() => {
|
||||
this.initClient();
|
||||
}, 500)
|
||||
|
||||
}
|
||||
async login(funid) {
|
||||
let result = {};
|
||||
try {
|
||||
const data = await AppleID.auth.signIn({state: funid+''})
|
||||
// Handle successful response.
|
||||
console.log("apple login success: ", JSON.stringify(data))
|
||||
result = {
|
||||
data: data.authorization.id_token,
|
||||
errcode: 0,
|
||||
};
|
||||
} catch ( error ) {
|
||||
// Handle error.
|
||||
console.log('apple login error: ', JSON.stringify(error))
|
||||
result = {
|
||||
errcode: 1,
|
||||
errmessage: error.error || error.message || error,
|
||||
}
|
||||
}
|
||||
jc.wallet.nativeSvr.handleNativeCallback(funid, JSON.stringify(result));
|
||||
}
|
||||
}
|
||||
|
132
public/js-assets/scripts/libs/google.client.js
Normal file
@ -0,0 +1,132 @@
|
||||
const scripts = ['https://apis.google.com/js/api.js', 'https://accounts.google.com/gsi/client'];
|
||||
const DISCOVERY_DOC = 'https://www.googleapis.com/discovery/v1/apis/drive/v3/rest';
|
||||
const CLIENT_ID = '53206975661-ih3r0ubph3rqejdq97b029difbrk2bqj.apps.googleusercontent.com';
|
||||
|
||||
// Authorization scopes required by the API; multiple scopes can be included, separated by spaces.
|
||||
const SCOPES = 'openid email profile';
|
||||
const SCOPES_DRIVE = 'https://www.googleapis.com/auth/drive.appdata';
|
||||
|
||||
export class GoogleClient {
|
||||
async initGApi() {
|
||||
return new Promise((resolve, reject) => {
|
||||
gapi.load('client', async () => {
|
||||
await gapi.client.init({ discoveryDocs: [DISCOVERY_DOC] });
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
}
|
||||
initTokenClient(scopes, cb) {
|
||||
this.tokenClient = google.accounts.oauth2.initTokenClient({
|
||||
client_id: CLIENT_ID,
|
||||
scope: scopes,
|
||||
callback: cb // defined later
|
||||
});
|
||||
console.log('google client init success');
|
||||
}
|
||||
async initGoolgeClient() {
|
||||
await Promise.all([loadSingleScript([scripts[0]]), loadSingleScript([scripts[1]])]);
|
||||
await this.initGApi();
|
||||
this.initTokenClient(SCOPES);
|
||||
}
|
||||
login(funid) {
|
||||
this.tokenClient.callback = async (resp) => {
|
||||
if (resp.error !== undefined) {
|
||||
throw resp;
|
||||
}
|
||||
console.log('token: ', gapi.client.getToken());
|
||||
this.access_token = gapi.client.getToken().access_token;
|
||||
let result = {
|
||||
data: gapi.client.getToken().access_token,
|
||||
errcode: 0,
|
||||
};
|
||||
jc.wallet.nativeSvr.handleNativeCallback(funid, JSON.stringify(result));
|
||||
};
|
||||
|
||||
if (gapi.client.getToken() === null) {
|
||||
// Prompt the user to select a Google Account and ask for consent to share their data
|
||||
// when establishing a new session.
|
||||
this.tokenClient.requestAccessToken({ prompt: 'consent' });
|
||||
} else {
|
||||
// Skip display of account chooser and consent dialog for an existing session.
|
||||
this.tokenClient.requestAccessToken({ prompt: '' });
|
||||
}
|
||||
}
|
||||
generateCfgName(key) {
|
||||
return `wallet_${key}.json`;
|
||||
}
|
||||
hasDriveScope() {
|
||||
return google.accounts.oauth2.hasGrantedAnyScope(gapi.client.getToken(), SCOPES_DRIVE);
|
||||
}
|
||||
async requestDriveScope() {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.initTokenClient(SCOPES + " " + SCOPES_DRIVE, (resp) => {
|
||||
if (resp.error !== undefined) {
|
||||
throw resp;
|
||||
}
|
||||
resolve();
|
||||
});
|
||||
this.tokenClient.requestAccessToken({ prompt: 'consent' });
|
||||
});
|
||||
}
|
||||
async listFiles() {
|
||||
return gapi.client.drive.files.list({
|
||||
spaces: 'appDataFolder',
|
||||
fields: 'files(id, name)',
|
||||
});
|
||||
}
|
||||
async downloadCfg(key) {
|
||||
if (!this.hasDriveScope()) {
|
||||
await this.requestDriveScope();
|
||||
}
|
||||
let fileName = this.generateCfgName(key)
|
||||
let files = await this.listFiles();
|
||||
let file = files.result.files.find((file) => file.name.toLowerCase() === fileName.toLowerCase());
|
||||
if (file) {
|
||||
let fileId = file.id;
|
||||
let info = await gapi.client.drive.files.get({
|
||||
fileId: fileId,
|
||||
alt: 'media',
|
||||
});
|
||||
return info.result;
|
||||
}
|
||||
}
|
||||
async uploadOneFile(content, fileName) {
|
||||
return new Promise((resolve, reject) => {
|
||||
var file = new Blob([JSON.stringify(content)], {type: 'application/json'});
|
||||
var metadata = {
|
||||
'name': fileName, // Filename at Google Drive
|
||||
'mimeType': 'application/json', // mimeType at Google Drive
|
||||
'parents': ['appDataFolder'], // Folder ID at Google Drive
|
||||
};
|
||||
|
||||
var accessToken = gapi.auth.getToken().access_token; // Here gapi is used for retrieving the access token.
|
||||
var form = new FormData();
|
||||
form.append('metadata', new Blob([JSON.stringify(metadata)], {type: 'application/json'}));
|
||||
form.append('file', file);
|
||||
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('post', 'https://www.googleapis.com/upload/drive/v3/files?uploadType=multipart&fields=id');
|
||||
xhr.setRequestHeader('Authorization', 'Bearer ' + accessToken);
|
||||
xhr.responseType = 'json';
|
||||
xhr.onload = () => {
|
||||
console.log(xhr.response.id); // Retrieve uploaded file ID.
|
||||
resolve && resolve(xhr.response);
|
||||
};
|
||||
xhr.send(form);
|
||||
});
|
||||
}
|
||||
async uploadCfg(key, pass) {
|
||||
if (!this.hasDriveScope()) {
|
||||
await this.requestDriveScope();
|
||||
}
|
||||
let fileName = this.generateCfgName(key);
|
||||
let files = await this.listFiles();
|
||||
let file = files.result.files.find((file) => file.name.toLowerCase() === fileName.toLowerCase());
|
||||
if (!file) {
|
||||
let res = await this.uploadOneFile({pass}, fileName);
|
||||
return res;
|
||||
} else {
|
||||
return file;
|
||||
}
|
||||
}
|
||||
}
|
6
public/js-assets/scripts/libs/html5-qrcode.min.js
vendored
Normal file
144
public/js-assets/scripts/libs/jcwallet.js
Normal file
801
public/js-assets/scripts/libs/main.js
Normal file
@ -0,0 +1,801 @@
|
||||
console.log('>> begin load wallet main file.');
|
||||
!window.jc || !jc.wallet ? new jcwallet.default() : jc.wallet;
|
||||
function promiseCb(funId, promiseFun, dataParser) {
|
||||
dataParser = dataParser || ((v) => v);
|
||||
promiseFun
|
||||
.then((result) => {
|
||||
jsb.jcCallback(funId, JSON.stringify({ errcode: 0, data: dataParser(result) }));
|
||||
})
|
||||
.catch((err) => {
|
||||
let code = err.statusCode || 1;
|
||||
jsb.jcCallback(funId, JSON.stringify({ errcode: code, errmsg: err.message || err }));
|
||||
});
|
||||
}
|
||||
/**
|
||||
* oauth login before init internal wallet
|
||||
* @param {string} channel:
|
||||
* 0: google,
|
||||
* 1: apple,
|
||||
* 2: tiktok,
|
||||
* 3: facebook,
|
||||
* 4: twitter
|
||||
* 5: tg,
|
||||
* 6: email,
|
||||
* 7: discord
|
||||
* 10: client
|
||||
* @param {string} env: dev release
|
||||
* @param {string} account: guest account to bind
|
||||
* @return {string} {token: string, address: string | null}
|
||||
* token: token for wallet services
|
||||
* address: address of wallet if already created (optional)
|
||||
*/
|
||||
function walletLogin(funId, channel, env, account) {
|
||||
channel = parseInt(channel);
|
||||
env = env || 'dev';
|
||||
console.log('walletLogin: ' + channel);
|
||||
promiseCb(funId, jc.wallet.preLogin(channel, env, account));
|
||||
}
|
||||
|
||||
function logout(funId, channel) {
|
||||
channel = parseInt(channel || '0');
|
||||
promiseCb(funId, jc.wallet.logout(channel));
|
||||
}
|
||||
|
||||
function updateGameInfo(funId, info) {
|
||||
jsb.updateGameInfo(funId, info);
|
||||
promiseCb(funId, Promise.resolve(1));
|
||||
}
|
||||
/**
|
||||
* init internal wallet with password
|
||||
* @param {string} chain: chain id
|
||||
* @param {string} pass: password for wallet
|
||||
* @param {string} env: dev release
|
||||
* @param {string} useApi: 1: yes, 0: no
|
||||
* @return {string} address
|
||||
* @throws {Error} if password is wrong
|
||||
*/
|
||||
function initInternalWallet(funId, chain, pass, env, useApi) {
|
||||
chain = parseInt(chain);
|
||||
useApi = (useApi && useApi == '1') ? true: false
|
||||
promiseCb(funId, jc.wallet.initInternalWallet(chain, pass, env, useApi), () => {
|
||||
return jc.wallet.nativeAccount;
|
||||
});
|
||||
}
|
||||
/**
|
||||
* verify if password is correct
|
||||
* compare with local password hash
|
||||
* @param {string} pass password for wallet
|
||||
*/
|
||||
function verifyPassword(funId, pass) {
|
||||
promiseCb(funId, jc.wallet.verifyLocalPass(pass));
|
||||
}
|
||||
/**
|
||||
* @Deprecated
|
||||
* init third party wallet
|
||||
* @param {number | string} chain chain id
|
||||
*/
|
||||
function initThirdPartyWallet(funId, chain, env, wallettype, provider) {
|
||||
chain = parseInt(chain);
|
||||
wallettype = parseInt(wallettype || '1');
|
||||
promiseCb(funId, jc.wallet.initThirdPartyWallet(chain, env, wallettype, provider));
|
||||
}
|
||||
|
||||
|
||||
function initRelayWallet(funId, chain, env) {
|
||||
chain = parseInt(chain);
|
||||
promiseCb(funId, jc.wallet.initRelayWallet(chain, env));
|
||||
}
|
||||
|
||||
/**
|
||||
* all chain list we supported
|
||||
* @return {string} JSON string of
|
||||
* [{ name: string
|
||||
* type: string
|
||||
* rpc: string
|
||||
* id: number
|
||||
* network?: string
|
||||
* symbol?: string
|
||||
* explorerurl?: string
|
||||
* decimals?: number
|
||||
* }]
|
||||
*/
|
||||
function chainList(funId) {
|
||||
let data = jc.wallet.chainList;
|
||||
promiseCb(funId, Promise.resolve(data));
|
||||
}
|
||||
/**
|
||||
* current actived chain info
|
||||
* @return {string} JSON string of
|
||||
* { name: string
|
||||
* type: string
|
||||
* rpc: string
|
||||
* id: number
|
||||
* network?: string
|
||||
* symbol?: string
|
||||
* explorerurl?: string
|
||||
* decimals?: number
|
||||
* }
|
||||
*/
|
||||
function currentChain(funId) {
|
||||
let data = jc.wallet.currentChain;
|
||||
promiseCb(funId, Promise.resolve(data));
|
||||
}
|
||||
/**
|
||||
* change current actived chain
|
||||
*/
|
||||
function changeChain(funId, chainId) {
|
||||
chainId = parseInt(chainId);
|
||||
promiseCb(funId, jc.wallet.updateCurrentChain(chainId));
|
||||
}
|
||||
/**
|
||||
* [BOTH] get sign for login
|
||||
* @param {string} nonce: nonce from server
|
||||
* @param {string} tips: tips message when sign
|
||||
*/
|
||||
function loginSign(funId, nonce, tips) {
|
||||
promiseCb(funId, jc.wallet.loginSign(nonce, tips));
|
||||
}
|
||||
|
||||
/**
|
||||
* get balance of ETH
|
||||
* @param {string} account: account
|
||||
* if account is null, we`ll query for current account of wallet
|
||||
*/
|
||||
function getEthBalance(funId, account) {
|
||||
promiseCb(funId, jc.wallet.chainCommon.getBalance(account));
|
||||
}
|
||||
|
||||
/**
|
||||
* send ETH from current account
|
||||
* @param {string} to: target account
|
||||
* @param {string} amount:
|
||||
* @param {string} estimate: 0: execute; 1: only estimate gas price; default: 0
|
||||
*/
|
||||
function sendEth(funId, to, amount, estimate) {
|
||||
estimate = (estimate || '0') | 0;
|
||||
promiseCb(funId, jc.wallet.chainCommon.sendEth(to, amount, estimate));
|
||||
}
|
||||
|
||||
/**
|
||||
* [BOTH] generate ICON with hashed message
|
||||
* @param {string} msg:
|
||||
* @param {string} diameter: size of icon
|
||||
*/
|
||||
function generateIcon(funId, msg, diameter) {
|
||||
try {
|
||||
diameter = parseFloat(diameter);
|
||||
let result = jc.wallet.generateIconData(msg, diameter);
|
||||
return JSON.stringify({ errcode: 0, data: result });
|
||||
} catch (err) {
|
||||
return JSON.stringify({ errcode: 1, errmsg: err.message || err });
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get symbol and decimal of ERC20, symbol and decimal
|
||||
* @param {string} address: address of ERC20
|
||||
*/
|
||||
function erc20Info(funId, address) {
|
||||
promiseCb(funId, jc.wallet.erc20Info(address));
|
||||
}
|
||||
/**
|
||||
* get balance of ERC20
|
||||
* @param {string} address:
|
||||
* @param {string} account:
|
||||
*/
|
||||
function erc20Balance(funId, address, account) {
|
||||
promiseCb(funId, jc.wallet.erc20Standard.getBalanceOf(address, account));
|
||||
}
|
||||
/**
|
||||
* send ERC20 token to to
|
||||
* @param {string} address: contract address of ERC20
|
||||
* @param {string} to: target account
|
||||
* @param {string} amount: amount of token to send
|
||||
* @param {string} estimate: 0: execute; 1: only estimate gas price; default: 0
|
||||
*/
|
||||
function sendErc20(funId, address, to, amount, estimate) {
|
||||
estimate = (estimate || '0') | 0;
|
||||
promiseCb(funId, jc.wallet.erc20Standard.transfer({address, to, amount, estimate}));
|
||||
}
|
||||
|
||||
/**
|
||||
* send ERC721 NFT to to
|
||||
* @param {string} address: contract address of NFT
|
||||
* @param {string} to: target account
|
||||
* @param {string} tokenId: nft id of NFT
|
||||
* @param {string} estimate: 0: execute; 1: only estimate gas price; default: 0
|
||||
*/
|
||||
function sendErc721(funId, address, to, tokenId, estimate) {
|
||||
estimate = (estimate || '0') | 0;
|
||||
promiseCb(funId, jc.wallet.erc721Standard.transfer({address, to, tokenId, estimate}));
|
||||
}
|
||||
|
||||
/**
|
||||
* get balance of ERC721
|
||||
* @param {string} address: contract address of NFT
|
||||
* @param {string} account: wallet address
|
||||
* @param {string} chainId: chain id, number string
|
||||
*/
|
||||
function erc721Balance(funId, address, account, chainId) {
|
||||
promiseCb(funId, jc.wallet.erc721Standard.getBalance(address, account, chainId));
|
||||
}
|
||||
|
||||
/**
|
||||
* get balance of ERC1155
|
||||
* @param {string} address: contract address of NFT
|
||||
* @param {string} account: wallet address
|
||||
* @param {string} tokenId: nft id of NFT
|
||||
*/
|
||||
function erc1155Balance(funId, address, account, tokenId) {
|
||||
promiseCb(funId, jc.wallet.erc1155Standard.getBalanceOf(address, account, tokenId));
|
||||
}
|
||||
|
||||
/**
|
||||
* send ERC1155 to to
|
||||
* @param {string} address: contract address of NFT
|
||||
* @param {string} to: target account
|
||||
* @param {string} tokenIds: nft id of NFT, json string of array
|
||||
* @param {string} amounts: amount of token to send, json string of array
|
||||
* @param {string} estimate: 0: execute; 1: only estimate gas price; default: 0
|
||||
*/
|
||||
function sendErc1155(funId, address, to, tokenIds, amounts, estimate) {
|
||||
tokenIds = JSON.parse(tokenIds);
|
||||
amounts = JSON.parse(amounts);
|
||||
estimate = (estimate || '0') | 0;
|
||||
promiseCb(funId, jc.wallet.erc1155Standard.transferBatch({address, to, tokenIds, amounts, estimate}));
|
||||
}
|
||||
|
||||
/**
|
||||
* show QRCode for content
|
||||
* @param {string} content: content to show
|
||||
*/
|
||||
function showQRCode(funId, content) {
|
||||
jsb.showQRCode(funId, content);
|
||||
promiseCb(funId, Promise.resolve(1));
|
||||
}
|
||||
/**
|
||||
* show webpage
|
||||
* don't call this when in web page
|
||||
* @param {string} url: url to show
|
||||
*/
|
||||
function showWebPage(funId, url) {
|
||||
try {
|
||||
jsb.showWebPage(funId, url);
|
||||
// jsb.openURL(url);
|
||||
return JSON.stringify({ errcode: 0, data: 1 });
|
||||
} catch (err) {
|
||||
return JSON.stringify({ errcode: 1, errmsg: err.message || err });
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* show QRCode scaner
|
||||
* @param {string} title: title of scaner
|
||||
*/
|
||||
function scanQRCode(funId, title) {
|
||||
console.log('scanQRCode: ' + title);
|
||||
promiseCb(funId, jc.wallet.nativeSvr.scanQRCode(title));
|
||||
}
|
||||
|
||||
/**
|
||||
* export wallet private key
|
||||
* @param {string} pass: password of wallet
|
||||
*/
|
||||
function exportWalletSecKey(funId, pass) {
|
||||
let data = jc.wallet.exportPrivateKey(pass);
|
||||
promiseCb(funId, Promise.resolve(data));
|
||||
}
|
||||
|
||||
// ======= begin of interact with contract =======
|
||||
/**
|
||||
* mint NFT
|
||||
* @param {string} address: contract address of NFT
|
||||
* @param {string} tokenIds: token id of NFT, JSON string of string array
|
||||
* @parsm {string} startTime: time of signature generation
|
||||
* @param {string} saltNonce: nonce of signature
|
||||
* @param {string} signature: signature
|
||||
* @param {string} estimate: 1: only estimate gas price
|
||||
*/
|
||||
function mintNFT(funId, address, tokenIds, startTime, saltNonce, signature, estimate) {
|
||||
tokenIds = JSON.parse(tokenIds);
|
||||
estimate = (estimate || '0') | 0;
|
||||
promiseCb(
|
||||
funId,
|
||||
jc.wallet.jcStandard.mintNFT({
|
||||
address,
|
||||
tokenIds,
|
||||
startTime,
|
||||
saltNonce,
|
||||
signature,
|
||||
estimate,
|
||||
}),
|
||||
(v) => JSON.stringify(v)
|
||||
);
|
||||
}
|
||||
// ======= end of interact with contract =======
|
||||
// ======= begin of pay =======
|
||||
/**
|
||||
* begin buy crypto with alchemy
|
||||
* @param {string} network: 'mainnet' or 'testnet'
|
||||
* @param {string} crypto: 'CEC' or 'CEG', 'ETH'
|
||||
* @param {string} address: wallet address of user
|
||||
* fiat: 'USD' or 'CNY'
|
||||
* fiatAmount: '100'
|
||||
* payWayCode: '10001'
|
||||
* country: 'US'
|
||||
* accountId: account id of game user
|
||||
* orderId: from pre pay
|
||||
*/
|
||||
function beginPay(
|
||||
funId,
|
||||
network,
|
||||
crypto,
|
||||
address,
|
||||
fiat,
|
||||
fiatAmount,
|
||||
payWayCode,
|
||||
country,
|
||||
accountId,
|
||||
orderId,
|
||||
timestamp,
|
||||
salt,
|
||||
sign
|
||||
) {
|
||||
promiseCb(
|
||||
funId,
|
||||
jc.wallet.paySvr.alchemyPrePay({
|
||||
crypto,
|
||||
address,
|
||||
fiat,
|
||||
fiatAmount,
|
||||
payWayCode,
|
||||
country,
|
||||
accountId,
|
||||
orderId,
|
||||
network,
|
||||
timestamp,
|
||||
salt,
|
||||
sign,
|
||||
})
|
||||
);
|
||||
}
|
||||
// ======= end of pay =======
|
||||
// ======= begin of transaction history =======
|
||||
/**
|
||||
* query eth transaction history
|
||||
* @param {string} start
|
||||
* @param {string} limit
|
||||
* @param {JSON string} moreParam e.g. {timeBegin: 1655716867832, timeEnd: 1655716867832}
|
||||
*/
|
||||
function ethHistory(funId, start, limit, moreParam) {
|
||||
moreParam = moreParam ? JSON.parse(moreParam) : {};
|
||||
promiseCb(funId, jc.wallet.historySvr.ethRecords(start, limit, moreParam));
|
||||
}
|
||||
/**
|
||||
* query token transaction history
|
||||
* @param {string} start
|
||||
* @param {string} limit
|
||||
* @param {string} address
|
||||
* @param {string} tokenId
|
||||
* @param {JSON string} moreParam e.g. {timeBegin: 1655716867832, timeEnd: 1655716867832}
|
||||
*/
|
||||
function tokenHistory(funId, start, limit, address, tokenId, moreParam) {
|
||||
moreParam = moreParam ? JSON.parse(moreParam) : {};
|
||||
var data = { start, limit, address, tokenId };
|
||||
promiseCb(funId, jc.wallet.historySvr.tokenRecords(data, moreParam));
|
||||
}
|
||||
// ======= end of transaction history =======
|
||||
|
||||
/**
|
||||
* get email info of current user
|
||||
*/
|
||||
function emailInfo(funId) {
|
||||
promiseCb(funId, jc.wallet.emailVerifySvr.checkEmailVerified());
|
||||
}
|
||||
/**
|
||||
* send code with email
|
||||
* @param {string} email
|
||||
* @param {string} type
|
||||
*/
|
||||
function sendEmailCode(funId, email, type) {
|
||||
promiseCb(funId, jc.wallet.emailVerifySvr.sendEmailCode(email, type));
|
||||
}
|
||||
/**
|
||||
* verify email with code, and update email
|
||||
* @param {string} email
|
||||
* @param {string} code
|
||||
*/
|
||||
function verifyEmail(funId, email, code) {
|
||||
promiseCb(funId, jc.wallet.emailVerifySvr.updateEmailVerify(email, code));
|
||||
}
|
||||
|
||||
/**
|
||||
* check if email had already been registed
|
||||
* @param {string} email
|
||||
*/
|
||||
function checkEmailExists(funId, email) {
|
||||
promiseCb(funId, jc.wallet.emailVerifySvr.isEmailRegister(email));
|
||||
}
|
||||
/**
|
||||
* regist with email
|
||||
* @param {*} email
|
||||
* @param {*} password
|
||||
* @param {*} code
|
||||
*/
|
||||
function emailRegist(funId, email, password, code) {
|
||||
promiseCb(funId, jc.wallet.emailVerifySvr.registByEmail(email, password, code));
|
||||
}
|
||||
|
||||
/**
|
||||
* login with email
|
||||
* @param {*} email
|
||||
* @param {*} password
|
||||
*/
|
||||
function emailLogin(funId, email, password) {
|
||||
promiseCb(funId, jc.wallet.emailLogin(email, password));
|
||||
}
|
||||
|
||||
/**
|
||||
* token list of current chain
|
||||
*/
|
||||
function tokenList(funId) {
|
||||
let data = jc.wallet.currentChainCfg.tokens;
|
||||
promiseCb(funId, Promise.resolve(data));
|
||||
}
|
||||
/**
|
||||
* calc token price of USD
|
||||
* token must already be in DEX
|
||||
* @param {*} tokenName
|
||||
* @param {*} amount
|
||||
*/
|
||||
function tokenPrice(funId, tokenName, amount) {
|
||||
promiseCb(funId, jc.wallet.calcTokenPrice(tokenName, amount));
|
||||
}
|
||||
|
||||
/**
|
||||
* fiat list
|
||||
*/
|
||||
function fiatList(funId) {
|
||||
promiseCb(funId, jc.wallet.paySvr.fetchFiatList());
|
||||
}
|
||||
/**
|
||||
* query price of crypto -> usd
|
||||
* @param {string} crypto
|
||||
* @param {number} chain chain id,
|
||||
*/
|
||||
function getCryptoPriceOfUSD(funId, crypto, chain) {
|
||||
let chainData = jc.wallet.currentChain;
|
||||
if (chain) {
|
||||
chainData = jc.wallet.chainList.find((v) => v.chainId === +chain);
|
||||
}
|
||||
let network = chainData.type !== 'Testnet' ? chainData.network || chainData.symbol : 'ARBITRUM';
|
||||
network = network || 'ARBITRUM';
|
||||
promiseCb(funId, jc.wallet.paySvr.queryTokenPrice(network, crypto));
|
||||
}
|
||||
|
||||
/**
|
||||
* format price
|
||||
* @param {string} value
|
||||
* @param {string} decimal: decimal of price
|
||||
* @param {string} fixed: fixed of price
|
||||
*/
|
||||
function formatPrice(funId, value, decimal, fixed) {
|
||||
let data = jc.wallet.formatPrice(value, decimal, fixed);
|
||||
promiseCb(funId, Promise.resolve(data));
|
||||
}
|
||||
|
||||
// begin of market
|
||||
// begin sell nft with market
|
||||
/**
|
||||
* sell nft with market
|
||||
* @param {string} nftToken: address of nft token to sell
|
||||
* @param {string} currency: address of currency
|
||||
* @param {string} tokenId: token id of nft to sell
|
||||
* @param {string} price: price of nft
|
||||
* @param {string} amount: amount of nft to sell, must be 1 for ERC721
|
||||
* @param {string} estimate: 0: execute; 1: only estimate gas price; default: 0
|
||||
*/
|
||||
function marketSellNFT(funId, nftToken, currency, tokenId, price, amount, estimate) {
|
||||
estimate = (estimate || '0') | 0;
|
||||
promiseCb(
|
||||
funId,
|
||||
jc.wallet.jcStandard.marketSellNFT({
|
||||
nftToken,
|
||||
currency,
|
||||
tokenId,
|
||||
price,
|
||||
amount,
|
||||
estimate,
|
||||
}),
|
||||
(v) => JSON.stringify(v)
|
||||
);
|
||||
}
|
||||
/**
|
||||
* update price of existed order
|
||||
* @param {string} orderId: order id
|
||||
* @param {string} price: new price
|
||||
* @param {string} estimate: 0: execute; 1: only estimate gas price; default: 0
|
||||
*/
|
||||
function marketUpdatePrice(funId, orderId, price, estimate) {
|
||||
estimate = (estimate || '0') | 0;
|
||||
promiseCb(
|
||||
funId,
|
||||
jc.wallet.jcStandard.marketUpdatePrice({
|
||||
orderId,
|
||||
price,
|
||||
estimate,
|
||||
}),
|
||||
(v) => JSON.stringify(v)
|
||||
);
|
||||
}
|
||||
/**
|
||||
* cancel order
|
||||
* @param {string} orderId: order id
|
||||
* @param {string} estimate: 0: execute; 1: only estimate gas price; default: 0
|
||||
*/
|
||||
function marketCancelOrder(funId, orderId, estimate) {
|
||||
estimate = (estimate || '0') | 0;
|
||||
promiseCb(
|
||||
funId,
|
||||
jc.wallet.jcStandard.marketCancelOrder({
|
||||
orderId,
|
||||
estimate,
|
||||
}),
|
||||
(v) => JSON.stringify(v)
|
||||
);
|
||||
}
|
||||
/**
|
||||
* buy order
|
||||
* @param {string} orderId: order id
|
||||
* @param {string} price: price of order
|
||||
* @param {string} estimate: 0: execute; 1: only estimate gas price; default: 0
|
||||
*/
|
||||
function marketBuy(funId, orderId, price, estimate) {
|
||||
estimate = (estimate || '0') | 0;
|
||||
promiseCb(
|
||||
funId,
|
||||
jc.wallet.jcStandard.marketBuy({
|
||||
orderId,
|
||||
price,
|
||||
estimate,
|
||||
}),
|
||||
(v) => JSON.stringify(v)
|
||||
);
|
||||
}
|
||||
/**
|
||||
* get order info from chain
|
||||
* @param {string} orderId: order id
|
||||
*/
|
||||
function marketOrderInfo(funId, orderId) {
|
||||
promiseCb(funId, jc.wallet.jcStandard.marketOrderInfo(orderId));
|
||||
}
|
||||
/**
|
||||
* buy item of game from market
|
||||
* @param {string} orderId: order id
|
||||
* @param {string} seller: seller address
|
||||
* @param {string} currency: address of currency
|
||||
* @param {string} price: price of order
|
||||
* @param {string} startTime: time for signature
|
||||
* @param {string} saltNonce: nonce for signature
|
||||
* @param {string} signature: signature
|
||||
* @param {string} estimate: 0: execute; 1: only estimate gas price; default: 0
|
||||
*/
|
||||
function gameMarketBuy(funId, orderId, seller, currency, price, startTime, saltNonce, signature, estimate) {
|
||||
estimate = (estimate || '0') | 0;
|
||||
promiseCb(
|
||||
funId,
|
||||
jc.wallet.jcStandard.gameMarketBuy({
|
||||
orderId,
|
||||
seller,
|
||||
currency,
|
||||
price,
|
||||
startTime,
|
||||
saltNonce,
|
||||
signature,
|
||||
estimate,
|
||||
}),
|
||||
(v) => JSON.stringify(v)
|
||||
);
|
||||
}
|
||||
// end of market
|
||||
|
||||
// begin of mall
|
||||
/**
|
||||
* buy item of game from mall
|
||||
* @param {string} orderId: order id
|
||||
* @param {string} currency: address of currency
|
||||
* @param {string} price: price of order
|
||||
* @param {string} startTime: time for signature
|
||||
* @param {string} saltNonce: nonce for signature
|
||||
* @param {string} signature: signature
|
||||
* @param {string} estimate: 0: execute; 1: only estimate gas price; default: 0
|
||||
*/
|
||||
function gameMallBuy(funId, orderId, currency, price, startTime, saltNonce, signature, estimate) {
|
||||
estimate = (estimate || '0') | 0;
|
||||
promiseCb(
|
||||
funId,
|
||||
jc.wallet.jcStandard.gameMallBuy({
|
||||
orderId,
|
||||
currency,
|
||||
price,
|
||||
startTime,
|
||||
saltNonce,
|
||||
signature,
|
||||
estimate,
|
||||
}),
|
||||
(v) => JSON.stringify(v)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* buy nft from mall
|
||||
* @param {string} currency: address of currency
|
||||
* @param {string} addresses: address of nft token, JSON string of array
|
||||
* @param {string} ids: token id of nft, JSON string of array
|
||||
* @param {string} amounts: amount of nft, JSON string of array
|
||||
* @param {string} values: JSON string, e.g. [orderId, price, startTime, saltNonce]
|
||||
* orderId: order id
|
||||
* price: price of order
|
||||
* startTime: time for signature
|
||||
* saltNonce: nonce for signature
|
||||
* @param {string} signature: signature
|
||||
* @param {string} gas: gas price
|
||||
* @param {string} estimate: 0: execute; 1: only estimate gas price; default: 0
|
||||
*/
|
||||
function nftMallBuy(funId, currency, addresses, ids, amounts, values, signature, gas, estimate) {
|
||||
estimate = (estimate || '0') | 0;
|
||||
addresses = JSON.parse(addresses);
|
||||
ids = JSON.parse(ids);
|
||||
amounts = JSON.parse(amounts);
|
||||
values = JSON.parse(values);
|
||||
promiseCb(
|
||||
funId,
|
||||
jc.wallet.jcStandard.mallBuy({
|
||||
currency,
|
||||
addresses,
|
||||
ids,
|
||||
amounts,
|
||||
values,
|
||||
signature,
|
||||
gas,
|
||||
estimate,
|
||||
}),
|
||||
(v) => JSON.stringify(v)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* buy ceg with usdt, usdc
|
||||
* @param {string} currency: address of currency
|
||||
* @param {string} amount: amount of currency
|
||||
* @param {string} gas: gas price
|
||||
* @param {string} estimate: 0: execute; 1: only estimate gas price; default: 0
|
||||
*/
|
||||
function buyTokenWithErc20(funId, currency, amount, gas, estimate) {
|
||||
estimate = (estimate || '0') | 0;
|
||||
promiseCb(
|
||||
funId,
|
||||
jc.wallet.jcStandard.buyTokenWithErc20({
|
||||
currency,
|
||||
amount,
|
||||
estimate,
|
||||
}),
|
||||
(v) => JSON.stringify(v)
|
||||
);
|
||||
}
|
||||
// end of mall
|
||||
|
||||
// begin of in-app pay
|
||||
/**
|
||||
* query google or ios products with product ids
|
||||
* @param {string} productIds: product id for query, JSON string of array
|
||||
*/
|
||||
function queryGoogleProducts(funId, productIds) {
|
||||
let ids = JSON.parse(productIds);
|
||||
console.log('queryGoogleProducts:: ' + productIds);
|
||||
if (window.JavascriptJavaBridge) {
|
||||
promiseCb(funId, jc.wallet.paySvr.queryGoogleProducts(ids));
|
||||
} else {
|
||||
promiseCb(funId, jc.wallet.paySvr.queryIOSProducts(ids));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* query google or ios purchases unfinished
|
||||
*/
|
||||
function queryGooglePurchases(funId) {
|
||||
if (window.JavascriptJavaBridge) {
|
||||
promiseCb(funId, jc.wallet.paySvr.queryGooglePurchases());
|
||||
} else {
|
||||
promiseCb(funId, jc.wallet.paySvr.queryIOSPurchases());
|
||||
}
|
||||
}
|
||||
/**
|
||||
* begin google or ios pay
|
||||
* @param {string} productId: product id
|
||||
* @param {string} orderId: order id
|
||||
*/
|
||||
function beginGoogleBuy(funId, productId, orderId) {
|
||||
if (window.JavascriptJavaBridge) {
|
||||
promiseCb(funId, jc.wallet.paySvr.buyGoogleProduct(productId, orderId));
|
||||
} else {
|
||||
promiseCb(funId, jc.wallet.paySvr.beginIOSPurchase(productId, orderId));
|
||||
}
|
||||
}
|
||||
// end of in-app pay
|
||||
|
||||
// begin of staking
|
||||
/**
|
||||
* stake nft
|
||||
* @param {string} nfts: address of nft token, JSON string of array
|
||||
* @param {string} tokenIds: token id of nft, JSON string of array
|
||||
* @param {string} staketimes: staking time of nft, JSON string of array
|
||||
* @param {string} gas: gas price
|
||||
* @param {string} estimate: 0: execute; 1: only estimate gas price; default: 0
|
||||
*/
|
||||
function stakeNfts(funId, nfts, tokenIds, staketimes, gas, estimate) {
|
||||
estimate = (estimate || '0') | 0;
|
||||
nfts = JSON.parse(nfts);
|
||||
tokenIds = JSON.parse(tokenIds);
|
||||
staketimes = JSON.parse(staketimes);
|
||||
promiseCb(funId, jc.wallet.jcStandard.stakeNfts({ nfts, tokenIds, staketimes, gas, estimate }), (v) =>
|
||||
JSON.stringify(v)
|
||||
);
|
||||
}
|
||||
/**
|
||||
* redeem nft
|
||||
* @param {string} nfts: address of nft token, JSON string of array
|
||||
* @param {string} tokenIds: token id of nft, JSON string of array
|
||||
* @param {string} gas: gas price
|
||||
* @param {string} estimate: 0: execute; 1: only estimate gas price; default: 0
|
||||
*/
|
||||
function redeemNfts(funId, nfts, tokenIds, gas, estimate) {
|
||||
estimate = (estimate || '0') | 0;
|
||||
nfts = JSON.parse(nfts);
|
||||
tokenIds = JSON.parse(tokenIds);
|
||||
promiseCb(funId, jc.wallet.jcStandard.redeemNfts({ nfts, tokenIds, gas, estimate }), (v) => JSON.stringify(v));
|
||||
}
|
||||
|
||||
/**
|
||||
* query nft stake info
|
||||
* @param {string} nft: address of nft token
|
||||
* @param {string} tokenId: token id of nft
|
||||
*/
|
||||
function nftStakeInfo(funId, nft, tokenId) {
|
||||
promiseCb(funId, jc.wallet.jcStandard.nftStakeInfo({ nft, tokenId }));
|
||||
}
|
||||
// end of staking
|
||||
|
||||
/**
|
||||
* delete account
|
||||
* delete account will delete game data for current account
|
||||
* wallet for current account will be remained
|
||||
*/
|
||||
function deleteAccount(funId) {
|
||||
promiseCb(funId, jc.wallet.deleteAccount());
|
||||
}
|
||||
/**
|
||||
* reset wallet address for current account
|
||||
*/
|
||||
function resetWalletAddress(funId) {
|
||||
promiseCb(funId, jc.wallet.resetWalletAddress());
|
||||
}
|
||||
/**
|
||||
* storage pass with google drive
|
||||
* @param {string} key: current account address
|
||||
* @param {string} val: pass for current account
|
||||
*/
|
||||
function storePassLocal(funId, key, val) {
|
||||
promiseCb(funId, jc.wallet.nativeSvr.storagePass(key, val));
|
||||
}
|
||||
/**
|
||||
* restore pass from google drive
|
||||
* @param {string} key: current account address
|
||||
*/
|
||||
function restorePassLocal(funId, key) {
|
||||
promiseCb(funId, jc.wallet.nativeSvr.authGetStoragePass(key));
|
||||
}
|
||||
|
||||
function getLocalPassState(funId, key) {
|
||||
promiseCb(funId, jc.wallet.nativeSvr.passStorageState(key));
|
||||
}
|
||||
|
464
public/js-assets/scripts/libs/main_native_inject.js
Normal file
@ -0,0 +1,464 @@
|
||||
console.log('>> inject main.js');
|
||||
if (jc.wallet.platform !== 'web') {
|
||||
/**
|
||||
* oauth login before init internal wallet
|
||||
* @param {*} channel 0: google, 1: apple, 2: tiktok, 3: facebook, 4: twitter 5: tg, 6: email, 7: discord 10: client
|
||||
*/
|
||||
function walletLogin(...args) {
|
||||
args.unshift('walletLogin');
|
||||
callProxyMethod.apply(this, args);
|
||||
}
|
||||
/**
|
||||
* init internal wallet with password
|
||||
* @param {number | string} chain chain id
|
||||
* @param {string} pass
|
||||
*/
|
||||
function initInternalWallet(...args) {
|
||||
args.unshift('initInternalWallet');
|
||||
callProxyMethod.apply(this, args);
|
||||
}
|
||||
/**
|
||||
* connect thirdparty wallet
|
||||
* @param {number | string} chain chain id
|
||||
* @param {string} pass
|
||||
*/
|
||||
function initThirdPartyWallet(...args) {
|
||||
args.unshift('initThirdPartyWallet');
|
||||
callProxyMethod.apply(this, args);
|
||||
}
|
||||
/**
|
||||
* verify if password is correct
|
||||
* compare with local password hash
|
||||
* @param {string} pass password for wallet
|
||||
*/
|
||||
function verifyPassword(...args) {
|
||||
args.unshift('verifyPassword');
|
||||
callProxyMethod.apply(this, args);
|
||||
}
|
||||
/**
|
||||
* init third party wallet
|
||||
* @param {number | string} chain chain id
|
||||
*/
|
||||
function initThirdPartyWallet(...args) {
|
||||
args.unshift('initThirdPartyWallet');
|
||||
callProxyMethod.apply(this, args);
|
||||
}
|
||||
|
||||
/**
|
||||
* all chain list we supported
|
||||
*/
|
||||
function chainList(...args) {
|
||||
args.unshift('chainList');
|
||||
callProxyMethod.apply(this, args);
|
||||
}
|
||||
/**
|
||||
* chain active
|
||||
*/
|
||||
function currentChain(...args) {
|
||||
args.unshift('currentChain');
|
||||
callProxyMethod.apply(this, args);
|
||||
}
|
||||
/**
|
||||
* [BOTH]change chain
|
||||
*/
|
||||
function changeChain(...args) {
|
||||
args.unshift('changeChain');
|
||||
callProxyMethod.apply(this, args);
|
||||
}
|
||||
/**
|
||||
* [BOTH] get sign for login
|
||||
* @param {string} nonce: nonce from server
|
||||
* @param {string} tips: tips message when sign
|
||||
*/
|
||||
function loginSign(...args) {
|
||||
args.unshift('loginSign');
|
||||
callProxyMethod.apply(this, args);
|
||||
}
|
||||
|
||||
/**
|
||||
* get balance of ETH
|
||||
* @param {string} account: account
|
||||
* if account is null, we`ll query for current account of wallet
|
||||
*/
|
||||
function getEthBalance(...args) {
|
||||
args.unshift('getEthBalance');
|
||||
callProxyMethod.apply(this, args);
|
||||
}
|
||||
|
||||
/**
|
||||
* send ETH from current account
|
||||
* @param {string} to: target account
|
||||
* @param {string} amount:
|
||||
* @param {number} estimate: 1: only estimate gas price
|
||||
*/
|
||||
function sendEth(...args) {
|
||||
args.unshift('sendEth');
|
||||
callProxyMethod.apply(this, args);
|
||||
}
|
||||
|
||||
/**
|
||||
* [BOTH] generate ICON with hashed message
|
||||
* @param {string} msg:
|
||||
* @param {string} diameter: size of icon
|
||||
*/
|
||||
// function generateIcon(...args) {
|
||||
// try {
|
||||
// diameter = parseFloat(diameter);
|
||||
// let result = jc.wallet.generateIconData(msg, diameter);
|
||||
// return JSON.stringify({ errcode: 0, data: result });
|
||||
// } catch (err) {
|
||||
// return JSON.stringify({ errcode: 1, errmsg: err.message || err });
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* get symbol and decimal of ERC20, symbol and decimal
|
||||
* @param {string} address: address of ERC20
|
||||
*/
|
||||
function erc20Info(...args) {
|
||||
args.unshift('erc20Info');
|
||||
callProxyMethod.apply(this, args);
|
||||
}
|
||||
/**
|
||||
* get balance of ERC20
|
||||
* @param {string} address:
|
||||
* @param {string} account:
|
||||
*/
|
||||
function erc20Balance(...args) {
|
||||
args.unshift('erc20Balance');
|
||||
callProxyMethod.apply(this, args);
|
||||
}
|
||||
/**
|
||||
* send ERC20 token to to
|
||||
*/
|
||||
function sendErc20(...args) {
|
||||
args.unshift('sendErc20');
|
||||
callProxyMethod.apply(this, args);
|
||||
}
|
||||
|
||||
/**
|
||||
* send ERC721 NFT to to
|
||||
*/
|
||||
function sendErc721(...args) {
|
||||
args.unshift('sendErc721');
|
||||
callProxyMethod.apply(this, args);
|
||||
}
|
||||
|
||||
/**
|
||||
* get balance of ERC721
|
||||
* @param {string} address: contract address of NFT
|
||||
* @param {string} account: wallet address
|
||||
* @param {string} chainId: chain id, number string
|
||||
*/
|
||||
function erc721Balance(...args) {
|
||||
args.unshift('erc721Balance');
|
||||
callProxyMethod.apply(this, args);
|
||||
}
|
||||
|
||||
/**
|
||||
* get balance of ERC1155
|
||||
* @param {string} address:
|
||||
* @param {string} account:
|
||||
* @param {string} tokenId:
|
||||
*/
|
||||
function erc1155Balance(...args) {
|
||||
args.unshift('erc1155Balance');
|
||||
callProxyMethod.apply(this, args);
|
||||
}
|
||||
|
||||
/**
|
||||
* send ERC1155 to to
|
||||
*/
|
||||
function sendErc1155(...args) {
|
||||
args.unshift('sendErc1155');
|
||||
callProxyMethod.apply(this, args);
|
||||
}
|
||||
|
||||
// function showQRCode(...args) {
|
||||
// args.unshift('showQRCode');
|
||||
// callProxyMethod.apply(this, args);
|
||||
// }
|
||||
// function scanQRCode(...args) {
|
||||
// args.unshift('scanQRCode');
|
||||
// callProxyMethod.apply(this, args);
|
||||
// }
|
||||
// function showWebPage(...args) {
|
||||
// try {
|
||||
// jsb.showWebPage(...args);
|
||||
// // jsb.openURL(url);
|
||||
// return JSON.stringify({ errcode: 0, data: 1 });
|
||||
// } catch (err) {
|
||||
// return JSON.stringify({ errcode: 1, errmsg: err.message || err });
|
||||
// }
|
||||
// }
|
||||
|
||||
// function scanQRCode(...args) {
|
||||
// console.log('scanQRCode: ' + title);
|
||||
// promiseCb(...args));
|
||||
// }
|
||||
|
||||
function exportWalletSecKey(...args) {
|
||||
args.unshift('exportWalletSecKey');
|
||||
callProxyMethod.apply(this, args);
|
||||
}
|
||||
|
||||
// ======= begin of interact with contract =======
|
||||
function mintNFT(...args) {
|
||||
args.unshift('mintNFT');
|
||||
callProxyMethod.apply(this, args);
|
||||
}
|
||||
// ======= end of interact with contract =======
|
||||
// ======= begin of pay =======
|
||||
/**
|
||||
* crypto: 'CEC' or 'CEG', 'ETH'
|
||||
* address: wallet address of user
|
||||
* fiat: 'USD' or 'CNY'
|
||||
* fiatAmount: '100'
|
||||
* payWayCode: '10001'
|
||||
* country: 'US'
|
||||
* accountId: account id of game user
|
||||
* orderId: from pre pay
|
||||
*/
|
||||
function beginPay(...args) {
|
||||
args.unshift('beginPay');
|
||||
callProxyMethod.apply(this, args);
|
||||
}
|
||||
// ======= end of pay =======
|
||||
// ======= begin of transaction history =======
|
||||
/**
|
||||
*
|
||||
* @param {*} funId
|
||||
* @param {*} start
|
||||
* @param {*} limit
|
||||
* @param {*} moreParam e.g. {timeBegin: 1655716867832, timeEnd: 1655716867832}
|
||||
*/
|
||||
function ethHistory(...args) {
|
||||
args.unshift('ethHistory');
|
||||
callProxyMethod.apply(this, args);
|
||||
}
|
||||
|
||||
function tokenHistory(...args) {
|
||||
args.unshift('tokenHistory');
|
||||
callProxyMethod.apply(this, args);
|
||||
}
|
||||
// ======= end of transaction history =======
|
||||
|
||||
/**
|
||||
* get email info of current user
|
||||
*/
|
||||
function emailInfo(...args) {
|
||||
args.unshift('emailInfo');
|
||||
callProxyMethod.apply(this, args);
|
||||
}
|
||||
/**
|
||||
* send code with email
|
||||
* @param {*} email
|
||||
* @param {*} type
|
||||
*/
|
||||
function sendEmailCode(...args) {
|
||||
args.unshift('sendEmailCode');
|
||||
callProxyMethod.apply(this, args);
|
||||
}
|
||||
/**
|
||||
* verify email with code, and update email
|
||||
* @param {*} email
|
||||
* @param {*} code
|
||||
*/
|
||||
function verifyEmail(...args) {
|
||||
args.unshift('verifyEmail');
|
||||
callProxyMethod.apply(this, args);
|
||||
}
|
||||
|
||||
/**
|
||||
* check if email had already been registed
|
||||
* @param {*} email
|
||||
*/
|
||||
function checkEmailExists(...args) {
|
||||
args.unshift('checkEmailExists');
|
||||
callProxyMethod.apply(this, args);
|
||||
}
|
||||
/**
|
||||
* regist with email
|
||||
* @param {*} email
|
||||
* @param {*} password
|
||||
* @param {*} code
|
||||
*/
|
||||
function emailRegist(...args) {
|
||||
args.unshift('emailRegist');
|
||||
callProxyMethod.apply(this, args);
|
||||
}
|
||||
|
||||
/**
|
||||
* login with email
|
||||
* @param {*} email
|
||||
* @param {*} password
|
||||
*/
|
||||
function emailLogin(...args) {
|
||||
args.unshift('emailLogin');
|
||||
callProxyMethod.apply(this, args);
|
||||
}
|
||||
|
||||
/**
|
||||
* token list of current chain
|
||||
*/
|
||||
function tokenList(...args) {
|
||||
args.unshift('tokenList');
|
||||
callProxyMethod.apply(this, args);
|
||||
}
|
||||
/**
|
||||
* calc token price of USD
|
||||
* token must already be in DEX
|
||||
* @param {*} tokenName
|
||||
* @param {*} amount
|
||||
*/
|
||||
function tokenPrice(...args) {
|
||||
args.unshift('tokenPrice');
|
||||
callProxyMethod.apply(this, args);
|
||||
}
|
||||
|
||||
/**
|
||||
* fiat list
|
||||
*/
|
||||
function fiatList(...args) {
|
||||
args.unshift('fiatList');
|
||||
callProxyMethod.apply(this, args);
|
||||
}
|
||||
/**
|
||||
* query price of crypto -> usd
|
||||
* @param {string} crypto
|
||||
* @param {number} chain chain id,
|
||||
*/
|
||||
function getCryptoPriceOfUSD(...args) {
|
||||
args.unshift('getCryptoPriceOfUSD');
|
||||
callProxyMethod.apply(this, args);
|
||||
}
|
||||
|
||||
/**
|
||||
* format price
|
||||
*/
|
||||
function formatPrice(...args) {
|
||||
args.unshift('formatPrice');
|
||||
callProxyMethod.apply(this, args);
|
||||
}
|
||||
|
||||
// begin of market
|
||||
// begin sell nft with market
|
||||
function marketSellNFT(...args) {
|
||||
args.unshift('marketSellNFT');
|
||||
callProxyMethod.apply(this, args);
|
||||
}
|
||||
// update price of order
|
||||
function marketUpdatePrice(...args) {
|
||||
args.unshift('marketUpdatePrice');
|
||||
callProxyMethod.apply(this, args);
|
||||
}
|
||||
// cancel order
|
||||
function marketCancelOrder(...args) {
|
||||
args.unshift('marketCancelOrder');
|
||||
callProxyMethod.apply(this, args);
|
||||
}
|
||||
// buy order
|
||||
function marketBuy(...args) {
|
||||
args.unshift('marketBuy');
|
||||
callProxyMethod.apply(this, args);
|
||||
}
|
||||
// buy item of game from market
|
||||
function gameMarketBuy(...args) {
|
||||
args.unshift('gameMarketBuy');
|
||||
callProxyMethod.apply(this, args);
|
||||
}
|
||||
// get order info from chain
|
||||
function marketOrderInfo(...args) {
|
||||
args.unshift('marketOrderInfo');
|
||||
callProxyMethod.apply(this, args);
|
||||
}
|
||||
// end of market
|
||||
|
||||
// begin of mall
|
||||
// buy item of game from mall
|
||||
function gameMallBuy(...args) {
|
||||
args.unshift('gameMallBuy');
|
||||
callProxyMethod.apply(this, args);
|
||||
}
|
||||
// end of mall
|
||||
|
||||
// begin of NFT mall
|
||||
function nftMallBuy(...args) {
|
||||
args.unshift('nftMallBuy');
|
||||
callProxyMethod.apply(this, args);
|
||||
}
|
||||
|
||||
// end of NFT mall
|
||||
|
||||
// begin of token mall
|
||||
// buy ceg with usdt, usdc
|
||||
function buyTokenWithErc20(...args) {
|
||||
args.unshift('buyTokenWithErc20');
|
||||
callProxyMethod.apply(this, args);
|
||||
}
|
||||
// begin of token mall
|
||||
|
||||
function stakeNfts(...args) {
|
||||
args.unshift('stakeNfts');
|
||||
callProxyMethod.apply(this, args);
|
||||
}
|
||||
function redeemNfts(...args) {
|
||||
args.unshift('redeemNfts');
|
||||
callProxyMethod.apply(this, args);
|
||||
}
|
||||
function nftStakeInfo(...args) {
|
||||
args.unshift('nftStakeInfo');
|
||||
callProxyMethod.apply(this, args);
|
||||
}
|
||||
|
||||
// begin of in-app pay
|
||||
function queryGoogleProducts(...args) {
|
||||
args.unshift('queryGoogleProducts');
|
||||
callProxyMethod.apply(this, args);
|
||||
}
|
||||
|
||||
function queryGooglePurchases(...args) {
|
||||
args.unshift('queryGooglePurchases');
|
||||
callProxyMethod.apply(this, args);
|
||||
}
|
||||
|
||||
function beginGoogleBuy(...args) {
|
||||
args.unshift('beginGoogleBuy');
|
||||
callProxyMethod.apply(this, args);
|
||||
}
|
||||
// end of in-app pay
|
||||
|
||||
function deleteAccount(...args) {
|
||||
args.unshift('deleteAccount');
|
||||
callProxyMethod.apply(this, args);
|
||||
}
|
||||
|
||||
function resetWalletAddress(...args) {
|
||||
args.unshift('resetWalletAddress');
|
||||
callProxyMethod.apply(this, args);
|
||||
}
|
||||
|
||||
// function storePassLocal(...args) {
|
||||
// promiseCb(...args));
|
||||
// }
|
||||
|
||||
// function restorePassLocal(...args) {
|
||||
// promiseCb(...args));
|
||||
// }
|
||||
|
||||
// function getLocalPassState(...args) {
|
||||
// promiseCb(...args));
|
||||
// }
|
||||
|
||||
// function saveLocalVal(...args) {
|
||||
// const wallet = !window.jc || !jc.wallet ? new jcwallet.default({ type: 0 }) : jc.wallet;
|
||||
// wallet.saveLocalItem(key, val);
|
||||
// return JSON.stringify({ errcode: 0, data: 1 });
|
||||
// }
|
||||
|
||||
// function loadLocalVal(...args) {
|
||||
// const wallet = !window.jc || !jc.wallet ? new jcwallet.default({ type: 0 }) : jc.wallet;
|
||||
// let val = wallet.loadLocalItem(key);
|
||||
// return JSON.stringify({ errcode: 0, data: val });
|
||||
// }
|
||||
}
|
228
public/js-assets/scripts/libs/native_bridge.js
Normal file
@ -0,0 +1,228 @@
|
||||
import init, {
|
||||
wget_address,
|
||||
hash_pass_svr,
|
||||
sign,
|
||||
sign_for_tran,
|
||||
generate_sec_key,
|
||||
generate_scrypt_hash,
|
||||
generate_qr,
|
||||
encrypt_content,
|
||||
decrypt_content,
|
||||
} from '../../wasm/rustwallet.js';
|
||||
import { QrScanner, showQr } from './qr_reading.js';
|
||||
import { GoogleClient } from './google.client.js';
|
||||
import { AppleClient } from './apple.client.js';
|
||||
// call native method
|
||||
|
||||
let googleClient = null;
|
||||
let appleClient = null;
|
||||
let walletCache = [];
|
||||
|
||||
async function initWasm() {
|
||||
if (jc.wallet.platform === 'web') {
|
||||
googleClient = new GoogleClient();
|
||||
await init();
|
||||
await googleClient.initGoolgeClient();
|
||||
appleClient = new AppleClient();
|
||||
await appleClient.initAppleClient();
|
||||
window.dispatchEvent(new CustomEvent('envready'));
|
||||
}
|
||||
}
|
||||
|
||||
function callNative(data) {
|
||||
let dataStr = JSON.stringify(data);
|
||||
console.log('call native: ' + dataStr);
|
||||
if (jc.wallet.platform === 'android_game_web') {
|
||||
cfwallet_JuEd8Ql5over8kneww.pageCall(dataStr);
|
||||
} else if (jc.wallet.platform === 'ios_game_web') {
|
||||
webkit.messageHandlers.pageCall.postMessage(dataStr);
|
||||
}
|
||||
}
|
||||
// for native call js
|
||||
function nativeCall(funid, val) {
|
||||
console.log('from native: ' + val);
|
||||
if (!val) {
|
||||
return;
|
||||
}
|
||||
jc.wallet.nativeSvr.handleNativeCallback(funid, val);
|
||||
}
|
||||
// for proxy method callback
|
||||
function proxyCallback(funid, data) {
|
||||
window.dispatchEvent(
|
||||
new CustomEvent('walletcb', {
|
||||
detail: { funid, data },
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
window.jsb = {
|
||||
jcCallback: function (funid, data) {
|
||||
window.dispatchEvent(
|
||||
new CustomEvent('walletcb', {
|
||||
detail: { funid, data },
|
||||
})
|
||||
);
|
||||
},
|
||||
// BEGIN:: only for web
|
||||
signWithApple: function (funid) {
|
||||
// callNative({ action: 'signWithApple', funid });
|
||||
appleClient.login(funid);
|
||||
},
|
||||
signWithGoogle: function (funid) {
|
||||
googleClient.login(funid);
|
||||
},
|
||||
signWithTikTok: function (funid) {
|
||||
callNative({ action: 'signWithTikTok', funid });
|
||||
},
|
||||
signWithFacebook: function (funid) {
|
||||
callNative({ action: 'signWithFacebook', funid });
|
||||
},
|
||||
// method that returns immediately
|
||||
// id, openid, mast-key, salt, pass
|
||||
prepareWallet: function (...args) {
|
||||
let address = wget_address.apply(this, args);
|
||||
walletCache = args;
|
||||
return address;
|
||||
},
|
||||
walletSecKey: function (...args) {
|
||||
let address = wget_address.apply(this, args);
|
||||
let key = generate_sec_key.apply(this, args);
|
||||
return JSON.stringify({ address, key });
|
||||
},
|
||||
hashSvrPass: function (msg) {
|
||||
return hash_pass_svr(msg);
|
||||
},
|
||||
walletSign: function (msg) {
|
||||
let args = [...walletCache, msg];
|
||||
return sign.apply(this, args);
|
||||
},
|
||||
walletSignTran: function (msg) {
|
||||
let args = [...walletCache, msg];
|
||||
return sign_for_tran.apply(this, args);
|
||||
},
|
||||
jcCryptoScrypt: function (...args) {
|
||||
return generate_scrypt_hash.apply(this, args);
|
||||
},
|
||||
// END:: only for web
|
||||
// BEGIN:: native method
|
||||
scanQRCode: function (funid, title) {
|
||||
if (jc.wallet.platform === 'web') {
|
||||
this.scaner = this.scaner || new QrScanner();
|
||||
this.scaner.start(title,(result) => {
|
||||
this.scaner.stop();
|
||||
let data = {errcode: 0, data: result}
|
||||
nativeCall(funid, JSON.stringify(data));
|
||||
});
|
||||
} else {
|
||||
callNative({ action: 'scanQRCode', funid, title });
|
||||
}
|
||||
},
|
||||
showQRCode: function (funid, title) {
|
||||
if (jc.wallet.platform === 'web') {
|
||||
let str = generate_qr(title);
|
||||
showQr(str);
|
||||
} else {
|
||||
callNative({ action: 'showQRCode', funid, title });
|
||||
}
|
||||
},
|
||||
buyProduct: function (funid, productId, orderId) {
|
||||
callNative({ action: 'buyProduct', funid, productId, orderId });
|
||||
},
|
||||
queryPurchase: function (funid) {
|
||||
callNative({ action: 'queryPurchase', funid });
|
||||
},
|
||||
queryProducts: function (funid, productIds) {
|
||||
callNative({ action: 'queryProducts', funid, productIds });
|
||||
},
|
||||
finishTransaction: function (funid, transactionId) {
|
||||
callNative({ action: 'finishTransaction', funid, transactionId });
|
||||
},
|
||||
authGetStoragePass: function (funid, key) {
|
||||
if (jc.wallet.platform === 'web') {
|
||||
googleClient.downloadCfg(key).then((data) => {
|
||||
console.log(data);
|
||||
let r = decrypt_content(data.pass, key);
|
||||
let result = {errcode: 0, data: r};
|
||||
nativeCall(funid, JSON.stringify(result));
|
||||
});
|
||||
} else {
|
||||
callNative({ action: 'authGetStoragePass', funid, key });
|
||||
}
|
||||
},
|
||||
passStorageState: function (funid, key) {
|
||||
callNative({ action: 'passStorageState', funid, key });
|
||||
},
|
||||
storagePass: function (funid, key, pass) {
|
||||
if (jc.wallet.platform === 'web') {
|
||||
pass = encrypt_content(pass, key);
|
||||
googleClient.uploadCfg(key, pass).then((data) => {
|
||||
let result = {errcode: 0, data: data.id};
|
||||
nativeCall(funid, JSON.stringify(result));
|
||||
});
|
||||
} else {
|
||||
callNative({ action: 'storagePass', funid, key, pass });
|
||||
}
|
||||
},
|
||||
// END:: native method
|
||||
};
|
||||
|
||||
function callProxyMethod(...args) {
|
||||
var methodname = args.shift();
|
||||
var funid = args.shift();
|
||||
// var params = JSON.stringify(args);
|
||||
callNative({ action: 'proxyMethod', methodname, funid, params: args });
|
||||
}
|
||||
|
||||
class Deferred {
|
||||
constructor() {
|
||||
this.promise = new Promise((resolve, reject) => {
|
||||
this._resolve = resolve;
|
||||
this._reject = reject;
|
||||
});
|
||||
}
|
||||
resolve(value) {
|
||||
this._resolve(value);
|
||||
}
|
||||
reject(reason) {
|
||||
this._reject(reason);
|
||||
}
|
||||
then(onfulfilled, onrejected) {
|
||||
return this.promise.then(onfulfilled, onrejected);
|
||||
}
|
||||
catch(onrejected) {
|
||||
return this.promise.catch(onrejected);
|
||||
}
|
||||
}
|
||||
var cbmap = new Map();
|
||||
window.addEventListener('walletcb', (e) => {
|
||||
console.log('receive walletcb: ' + JSON.stringify(e.detail));
|
||||
var data = e.detail;
|
||||
if (cbmap.has(data.funid)) {
|
||||
cbmap.get(data.funid).resolve(data.data);
|
||||
cbmap.delete(data.funid);
|
||||
}
|
||||
});
|
||||
|
||||
const directMethod = new Set([]);
|
||||
function callMethod(...args) {
|
||||
var methodName = args.shift();
|
||||
let funid = ((Math.random() * 100000 + Math.random() * 1000) | 0) + '';
|
||||
args.unshift(funid);
|
||||
if (jc.wallet.platform === 'web' && directMethod.has(methodName)) {
|
||||
return window[methodName].apply(this, args);
|
||||
}
|
||||
let deferred = new Deferred();
|
||||
cbmap.set(funid, deferred);
|
||||
window[methodName].apply(this, args);
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
window.callMethod = callMethod;
|
||||
window.callProxyMethod = callProxyMethod;
|
||||
window.proxyCallback = proxyCallback;
|
||||
window.nativeCall = nativeCall;
|
||||
window.callNative = callNative;
|
||||
|
||||
(async () => {
|
||||
await initWasm();
|
||||
})();
|
102
public/js-assets/scripts/libs/qr_reading.js
Normal file
@ -0,0 +1,102 @@
|
||||
import { Html5Qrcode, Html5QrcodeSupportedFormats } from "./html5-qrcode.min.js"
|
||||
|
||||
export class QrScanner {
|
||||
constructor(domId) {
|
||||
domId = domId || 'qr-container';
|
||||
this.el = document.getElementById(domId);
|
||||
if (!this.el) {
|
||||
this.el = createDom();
|
||||
}
|
||||
this.render_id = 'qr-reader';
|
||||
this.config = { fps: 4, qrbox: (width, height) => {return { width: width * 0.8, height: height * 0.9 }}};
|
||||
this.scanner = new Html5Qrcode(this.render_id, { });
|
||||
this.el.addEventListener('click', this.stop.bind(this));
|
||||
document.getElementById('qr-close').addEventListener('click', this.stop.bind(this));
|
||||
}
|
||||
|
||||
start(title,onScanSuccess) {
|
||||
this.el.style.display = 'flex';
|
||||
document.getElementById('qr-title').innerText = title;
|
||||
const _onScanSuccess = (decodedText, decodedResult) => {
|
||||
onScanSuccess(decodedText);
|
||||
}
|
||||
const startScanner = () => {
|
||||
this.scanner.start({ facingMode: "environment" }, this.config, _onScanSuccess)
|
||||
.then((_) => {
|
||||
console.log('start scan');
|
||||
}, (e) => {
|
||||
console.log('scan error: ', e);
|
||||
});
|
||||
}
|
||||
startScanner();
|
||||
}
|
||||
|
||||
stop() {
|
||||
if (this.scanner && this.scanner.getState() === 2){
|
||||
this.scanner.stop().then((_) => {
|
||||
console.log('stop scan')
|
||||
});
|
||||
}
|
||||
this.el.style.display = 'none';
|
||||
}
|
||||
}
|
||||
export function showQr(svgStr) {
|
||||
let el = document.getElementById('qr-container');
|
||||
if (!el) {
|
||||
el = createDom();
|
||||
}
|
||||
document.getElementById('qr-title').innerText = '';
|
||||
let container = document.getElementById('qr-reader');
|
||||
container.innerHTML = svgStr;
|
||||
el.style.display = 'flex';
|
||||
}
|
||||
function createDom() {
|
||||
addStyle(css);
|
||||
let container = document.createElement('div');
|
||||
container.id = 'qr-container';
|
||||
container.className = 'qr-container';
|
||||
let h2 = document.createElement('h2');
|
||||
h2.innerText = 'Scan QR Code';
|
||||
h2.id = 'qr-title';
|
||||
container.appendChild(h2);
|
||||
let div = document.createElement('div');
|
||||
div.id = 'qr-reader';
|
||||
div.className = 'qr-div';
|
||||
container.appendChild(div);
|
||||
let button = document.createElement('button');
|
||||
button.innerText = 'Close';
|
||||
button.id = 'qr-close';
|
||||
container.appendChild(button);
|
||||
document.body.appendChild(container);
|
||||
var closeMe = function(e) {
|
||||
if (e.target.id !== 'qr-container' && e.target.id !== 'qr-close') {
|
||||
return false;
|
||||
}
|
||||
container.style.display = 'none';
|
||||
}
|
||||
container.addEventListener('click', closeMe);
|
||||
button.addEventListener('click', closeMe);
|
||||
return container;
|
||||
}
|
||||
const css = `
|
||||
.qr-container {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
left: 0px;
|
||||
top: 0px;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
margin: auto;
|
||||
display: none;
|
||||
background: #0000006b;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.qr-div {
|
||||
position: relative;
|
||||
padding: 0px;
|
||||
width: 500px;
|
||||
}
|
||||
`
|
18
public/js-assets/scripts/libs/utils.js
Normal file
@ -0,0 +1,18 @@
|
||||
function addStyle(content) {
|
||||
var target = document.head || document.getElementsByTagName('head')[0];
|
||||
var node = document.createElement("style");
|
||||
node.innerHTML = content;
|
||||
target.appendChild(node);
|
||||
}
|
||||
|
||||
function curry(func) {
|
||||
return function curried(...args) {
|
||||
if (args.length >= func.length) {
|
||||
return func.apply(this, args);
|
||||
} else {
|
||||
return function(...args2) {
|
||||
return curried.apply(this, args.concat(args2));
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
207
public/js-assets/scripts/run_sample.js
Normal file
@ -0,0 +1,207 @@
|
||||
var address = '0x1c2d7640d9510569ef2687b7729be8e1583c2781';
|
||||
const pages = {
|
||||
closePage: async function () {
|
||||
callNative({ action: 'closepage' });
|
||||
},
|
||||
loginWithApple: async function () {
|
||||
let res = await callMethod('walletLogin', '1', 'dev');
|
||||
console.log(res);
|
||||
},
|
||||
loginWithGoogle: async function () {
|
||||
let res = await callMethod('walletLogin', '0', 'dev');
|
||||
console.log(res);
|
||||
},
|
||||
// loginWithTiktok: async function() {
|
||||
// let res = await callMethod('walletLogin', '2', 'dev');
|
||||
// console.log(res);
|
||||
// },
|
||||
|
||||
// loginWithFacebook: async function() {
|
||||
// let res = await callMethod('walletLogin', '3', 'dev');
|
||||
// console.log(res);
|
||||
// },
|
||||
|
||||
// loginWithTwitter: async function() {
|
||||
// let res = await callMethod('walletLogin', '4', 'dev');
|
||||
// console.log(res);
|
||||
// },
|
||||
|
||||
initInternalWallet: async function () {
|
||||
let res = await callMethod('initInternalWallet', '421613', '111111', 'dev');
|
||||
console.log(res);
|
||||
},
|
||||
loginSign: async function () {
|
||||
let res = await callMethod('loginSign', '421613', 'sign for login');
|
||||
console.log(res);
|
||||
},
|
||||
exportWalletSecKey: async function () {
|
||||
let res = await callMethod('exportWalletSecKey', '111111');
|
||||
console.log(res);
|
||||
},
|
||||
|
||||
currentChain: async function () {
|
||||
let res = await callMethod('currentChain');
|
||||
console.log(res);
|
||||
},
|
||||
scanQRCode: async function () {
|
||||
let res = await callMethod('scanQRCode', 'scan');
|
||||
console.log(res);
|
||||
},
|
||||
showQRCode: async function () {
|
||||
let res = await callMethod('showQRCode', address);
|
||||
console.log(res);
|
||||
},
|
||||
|
||||
verifyPassword: async function () {
|
||||
let res = await callMethod('verifyPassword', '111111');
|
||||
console.log(res);
|
||||
},
|
||||
|
||||
|
||||
getEthBalance: async function () {
|
||||
let res = await callMethod('getEthBalance', address);
|
||||
console.log(res);
|
||||
},
|
||||
|
||||
erc20Balance: async function () {
|
||||
let res = await callMethod('erc20Balance', '0xaa34B79A0Ab433eaC900fB3CB9f191F5Cd27501D', address);
|
||||
console.log(res);
|
||||
},
|
||||
erc721Balance: async function () {
|
||||
let res = await callMethod(
|
||||
'erc721Balance',
|
||||
'0x3F13F83E6363D97d0353cAAfACA08B05D9BF3637',
|
||||
'0xb217e9529bf2208e76d9016b7411f335e30f0ad5',
|
||||
'42161'
|
||||
);
|
||||
console.log(res);
|
||||
},
|
||||
|
||||
sendEth: async function () {
|
||||
let res = await callMethod('sendEth', address, '0.01', '0');
|
||||
console.log(res);
|
||||
},
|
||||
|
||||
marketSellNFT: async function () {
|
||||
let res = await callMethod(
|
||||
'marketSellNFT',
|
||||
'0xE6A69474E04B93De50dd07F239d62879dB9bF716',
|
||||
'0x8dd1439E0C3254b4543d6D68b3C0C891E5Bd2eCE',
|
||||
'1043423364010011',
|
||||
'5000000000000000000',
|
||||
'1',
|
||||
'0'
|
||||
);
|
||||
console.log(res);
|
||||
},
|
||||
|
||||
marketCancelOrder: async function () {
|
||||
let res = await callMethod('marketCancelOrder', '2');
|
||||
console.log(res);
|
||||
},
|
||||
marketUpdatePrice: async function () {
|
||||
let res = await callMethod('marketUpdatePrice', '2', '5100000000000000000');
|
||||
console.log(res);
|
||||
},
|
||||
marketBuy: async function () {
|
||||
let res = await callMethod('marketBuy', '2');
|
||||
console.log(res);
|
||||
},
|
||||
|
||||
gameMallBuy: async function () {
|
||||
let res = await callMethod(
|
||||
'gameMallBuy',
|
||||
'50436890550010088000000000000000000000000000000000000000000000000000000000000',
|
||||
'0x2C7221588D4FBac2585D71618CD540e74c7413B8',
|
||||
'1000000000000000000',
|
||||
'1687163482',
|
||||
'50436890550010088000000000000000000000000000000000000000000000000000000000000',
|
||||
'0xb660bbc0131663be938c839ac9c8bfba4800cadde7c5c75ef14cea38d65ee46742c2893c42270d354beef5bf8482e2650553c10f5d00da0d30bdf4727e6e31111b'
|
||||
);
|
||||
console.log(res);
|
||||
},
|
||||
|
||||
gameMarketBuy: async function () {
|
||||
let res = await callMethod(
|
||||
'gameMarketBuy',
|
||||
'50436890550040088000000000000000000000000000000000000000000000000000000000000',
|
||||
'0x50A8e60041A206AcaA5F844a1104896224be6F39',
|
||||
'0x2C7221588D4FBac2585D71618CD540e74c7413B8',
|
||||
'1000000000000000000',
|
||||
'1687166158',
|
||||
'50436890550040088000000000000000000000000000000000000000000000000000000000000',
|
||||
'0x7be41f445add96f30df8877f340a5b1e6ac51a665d4e98542d012ac4cc1315d56fda2d65b1b92bd3bcf174e608a1066ff24cc7afbd712ab40ab78bbfa91d0f081b'
|
||||
);
|
||||
console.log(res);
|
||||
},
|
||||
|
||||
nftMallBuy: async function () {
|
||||
let res = await callMethod(
|
||||
'nftMallBuy',
|
||||
'0x2C7221588D4FBac2585D71618CD540e74c7413B8',
|
||||
'["0xae37bb7BcA26Bab9a11D8BaE8fdB97f63b82c189"], ["10"], ["1"], ["50436890550040088000000000000000000000000000000000000000000000000000000000000","1000000000000000000","1687259171","50436890550040088000000000000000000000000000000000000000000000000000000000000"]',
|
||||
'0xee9d497dac1ec563800a112424fb8f423610ff3996877049493e273fe9ec5e9610c441eeb19de4eaf190f2ac084da250eac3ea2b29ca1c397c2c3cfd246bfd5d1c'
|
||||
);
|
||||
console.log(res);
|
||||
},
|
||||
|
||||
stakeNfts: async function () {
|
||||
let res = await callMethod(
|
||||
'stakeNfts',
|
||||
'["0xEbC170185ad614C05Af38C820020b70E458717F5","0xEbC170185ad614C05Af38C820020b70E458717F5"]',
|
||||
'["2","3"]',
|
||||
'["2592000","2592000"]'
|
||||
);
|
||||
console.log(res);
|
||||
},
|
||||
|
||||
redeemNfts: async function () {
|
||||
let res = await callMethod(
|
||||
'redeemNfts',
|
||||
'["0xEbC170185ad614C05Af38C820020b70E458717F5","0xEbC170185ad614C05Af38C820020b70E458717F5"]',
|
||||
'["2","3"]'
|
||||
);
|
||||
console.log(res);
|
||||
},
|
||||
|
||||
queryGoogleProducts: async function () {
|
||||
let res = await callMethod('queryGoogleProducts', '["2999"]');
|
||||
console.log(res);
|
||||
},
|
||||
queryGooglePurchases: async function () {
|
||||
let res = await callMethod('queryGooglePurchases', '');
|
||||
console.log(res);
|
||||
},
|
||||
beginGoogleBuy: async function () {
|
||||
let res = await callMethod('beginGoogleBuy', '2999', '3F13F83E6363D97d0353cAAfACA08B05D9BF3637');
|
||||
console.log(res);
|
||||
},
|
||||
tokenPrice: async function () {
|
||||
let res = await callMethod('tokenPrice', 'USDT', '1');
|
||||
console.log(res);
|
||||
},
|
||||
emailInfo: async function () {
|
||||
let res = await callMethod('emailInfo');
|
||||
console.log(res);
|
||||
},
|
||||
getPass: async function() {
|
||||
let res = await callMethod('restorePassLocal', '0x1c2d7640d9510569ef2687b7729be8e1583c2781');
|
||||
console.log(res);
|
||||
},
|
||||
savePassCloud: async function() {
|
||||
let res = await callMethod('storePassLocal', '0x1c2d7640d9510569ef2687b7729be8e1583c2781', '111111');
|
||||
console.log(res);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
let app = document.getElementById('app');
|
||||
// for (let key in pages) {
|
||||
// let button = document.createElement('button');
|
||||
// button.innerText = key;
|
||||
// button.addEventListener('click', pages[key]);
|
||||
// app.appendChild(button);
|
||||
// }
|
||||
window.addEventListener('envready', (e) => {
|
||||
// console.log("Received the environment initialization event, we can now display the login button.");
|
||||
});
|
209
public/js-assets/wasm/rustwallet.d.ts
vendored
Normal file
@ -0,0 +1,209 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* @param {string} id
|
||||
* @param {string} openid
|
||||
* @param {string} master_key
|
||||
* @param {string} salt
|
||||
* @param {string} pass
|
||||
* @returns {string}
|
||||
*/
|
||||
export function get_public_key(id: string, openid: string, master_key: string, salt: string, pass: string): string;
|
||||
/**
|
||||
* @param {string} id
|
||||
* @param {string} openid
|
||||
* @param {string} master_key
|
||||
* @param {string} salt
|
||||
* @param {string} pass
|
||||
* @returns {string}
|
||||
*/
|
||||
export function generate_sec_key(id: string, openid: string, master_key: string, salt: string, pass: string): string;
|
||||
/**
|
||||
* @param {string} id
|
||||
* @param {string} openid
|
||||
* @param {string} master_key
|
||||
* @param {string} salt
|
||||
* @param {string} pass
|
||||
* @param {string} msg
|
||||
* @returns {string}
|
||||
*/
|
||||
export function sign(id: string, openid: string, master_key: string, salt: string, pass: string, msg: string): string;
|
||||
/**
|
||||
* @param {string} id
|
||||
* @param {string} openid
|
||||
* @param {string} master_key
|
||||
* @param {string} salt
|
||||
* @param {string} pass
|
||||
* @param {string} msg
|
||||
* @returns {string}
|
||||
*/
|
||||
export function sign_for_tran(id: string, openid: string, master_key: string, salt: string, pass: string, msg: string): string;
|
||||
/**
|
||||
* @param {string} content
|
||||
* @returns {string}
|
||||
*/
|
||||
export function keccak256_hash(content: string): string;
|
||||
/**
|
||||
* @param {string} pass
|
||||
* @param {string} salt
|
||||
* @param {number} n
|
||||
* @param {number} r
|
||||
* @param {number} p
|
||||
* @param {number} size
|
||||
* @returns {string}
|
||||
*/
|
||||
export function generate_scrypt_hash(pass: string, salt: string, n: number, r: number, p: number, size: number): string;
|
||||
/**
|
||||
* @param {string} id
|
||||
* @param {string} openid
|
||||
* @param {string} master_key
|
||||
* @param {string} salt
|
||||
* @param {string} pass
|
||||
* @returns {string}
|
||||
*/
|
||||
export function wget_address(id: string, openid: string, master_key: string, salt: string, pass: string): string;
|
||||
/**
|
||||
* @param {string} id
|
||||
* @param {string} openid
|
||||
* @param {string} master_key
|
||||
* @param {string} salt
|
||||
* @param {string} pass
|
||||
* @param {string} msg
|
||||
* @returns {string}
|
||||
*/
|
||||
export function wencrypt(id: string, openid: string, master_key: string, salt: string, pass: string, msg: string): string;
|
||||
/**
|
||||
* @param {string} id
|
||||
* @param {string} openid
|
||||
* @param {string} master_key
|
||||
* @param {string} salt
|
||||
* @param {string} pass
|
||||
* @param {string} msg
|
||||
* @returns {string}
|
||||
*/
|
||||
export function wdecrypt(id: string, openid: string, master_key: string, salt: string, pass: string, msg: string): string;
|
||||
/**
|
||||
* @param {string} content
|
||||
* @param {string} key
|
||||
* @returns {string}
|
||||
*/
|
||||
export function encrypt_content(content: string, key: string): string;
|
||||
/**
|
||||
* @param {string} content
|
||||
* @param {string} key
|
||||
* @returns {string}
|
||||
*/
|
||||
export function decrypt_content(content: string, key: string): string;
|
||||
/**
|
||||
* @param {string} content
|
||||
* @param {string} key
|
||||
* @returns {string}
|
||||
*/
|
||||
export function aes_encrypt(content: string, key: string): string;
|
||||
/**
|
||||
* @param {string} content
|
||||
* @param {string} key
|
||||
* @returns {string}
|
||||
*/
|
||||
export function aes_decrypt(content: string, key: string): string;
|
||||
/**
|
||||
* @param {string} pk
|
||||
* @param {string} msg
|
||||
* @returns {string}
|
||||
*/
|
||||
export function rencrypt(pk: string, msg: string): string;
|
||||
/**
|
||||
* @param {string} sk
|
||||
* @param {string} msg
|
||||
* @returns {string}
|
||||
*/
|
||||
export function rdecrypt(sk: string, msg: string): string;
|
||||
/**
|
||||
* @param {string} content
|
||||
* @returns {string}
|
||||
*/
|
||||
export function generate_qr(content: string): string;
|
||||
/**
|
||||
* @param {string} content
|
||||
* @returns {string}
|
||||
*/
|
||||
export function hex_deflate(content: string): string;
|
||||
/**
|
||||
* @param {string} content
|
||||
* @returns {string}
|
||||
*/
|
||||
export function hex_inflate(content: string): string;
|
||||
/**
|
||||
* @param {string} pass
|
||||
* @param {string} salt
|
||||
* @returns {string}
|
||||
*/
|
||||
export function password_hash(pass: string, salt: string): string;
|
||||
/**
|
||||
* @param {string} content
|
||||
* @returns {string}
|
||||
*/
|
||||
export function hash_pass_svr(content: string): string;
|
||||
/**
|
||||
* @param {string} pass
|
||||
* @param {string} pass_hash
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function password_verify(pass: string, pass_hash: string): boolean;
|
||||
|
||||
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
||||
|
||||
export interface InitOutput {
|
||||
readonly memory: WebAssembly.Memory;
|
||||
readonly get_public_key: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => void;
|
||||
readonly generate_sec_key: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => void;
|
||||
readonly sign: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number) => void;
|
||||
readonly sign_for_tran: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number) => void;
|
||||
readonly keccak256_hash: (a: number, b: number, c: number) => void;
|
||||
readonly generate_scrypt_hash: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
|
||||
readonly wget_address: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => void;
|
||||
readonly wencrypt: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number) => void;
|
||||
readonly wdecrypt: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number) => void;
|
||||
readonly encrypt_content: (a: number, b: number, c: number, d: number, e: number) => void;
|
||||
readonly decrypt_content: (a: number, b: number, c: number, d: number, e: number) => void;
|
||||
readonly aes_encrypt: (a: number, b: number, c: number, d: number, e: number) => void;
|
||||
readonly aes_decrypt: (a: number, b: number, c: number, d: number, e: number) => void;
|
||||
readonly rencrypt: (a: number, b: number, c: number, d: number, e: number) => void;
|
||||
readonly rdecrypt: (a: number, b: number, c: number, d: number, e: number) => void;
|
||||
readonly generate_qr: (a: number, b: number, c: number) => void;
|
||||
readonly hex_deflate: (a: number, b: number, c: number) => void;
|
||||
readonly hex_inflate: (a: number, b: number, c: number) => void;
|
||||
readonly password_hash: (a: number, b: number, c: number, d: number, e: number) => void;
|
||||
readonly hash_pass_svr: (a: number, b: number, c: number) => void;
|
||||
readonly password_verify: (a: number, b: number, c: number, d: number) => number;
|
||||
readonly rustsecp256k1_v0_7_0_context_create: (a: number) => number;
|
||||
readonly rustsecp256k1_v0_7_0_context_destroy: (a: number) => void;
|
||||
readonly rustsecp256k1_v0_7_0_default_illegal_callback_fn: (a: number, b: number) => void;
|
||||
readonly rustsecp256k1_v0_7_0_default_error_callback_fn: (a: number, b: number) => void;
|
||||
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
||||
readonly __wbindgen_malloc: (a: number) => number;
|
||||
readonly __wbindgen_realloc: (a: number, b: number, c: number) => number;
|
||||
readonly __wbindgen_free: (a: number, b: number) => void;
|
||||
readonly __wbindgen_exn_store: (a: number) => void;
|
||||
}
|
||||
|
||||
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
||||
/**
|
||||
* Instantiates the given `module`, which can either be bytes or
|
||||
* a precompiled `WebAssembly.Module`.
|
||||
*
|
||||
* @param {SyncInitInput} module
|
||||
*
|
||||
* @returns {InitOutput}
|
||||
*/
|
||||
export function initSync(module: SyncInitInput): InitOutput;
|
||||
|
||||
/**
|
||||
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
||||
* for everything else, calls `WebAssembly.instantiate` directly.
|
||||
*
|
||||
* @param {InitInput | Promise<InitInput>} module_or_path
|
||||
*
|
||||
* @returns {Promise<InitOutput>}
|
||||
*/
|
||||
export default function init (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>;
|
835
public/js-assets/wasm/rustwallet.js
Normal file
@ -0,0 +1,835 @@
|
||||
|
||||
let wasm;
|
||||
|
||||
const heap = new Array(32).fill(undefined);
|
||||
|
||||
heap.push(undefined, null, true, false);
|
||||
|
||||
function getObject(idx) { return heap[idx]; }
|
||||
|
||||
let heap_next = heap.length;
|
||||
|
||||
function dropObject(idx) {
|
||||
if (idx < 36) return;
|
||||
heap[idx] = heap_next;
|
||||
heap_next = idx;
|
||||
}
|
||||
|
||||
function takeObject(idx) {
|
||||
const ret = getObject(idx);
|
||||
dropObject(idx);
|
||||
return ret;
|
||||
}
|
||||
|
||||
function addHeapObject(obj) {
|
||||
if (heap_next === heap.length) heap.push(heap.length + 1);
|
||||
const idx = heap_next;
|
||||
heap_next = heap[idx];
|
||||
|
||||
heap[idx] = obj;
|
||||
return idx;
|
||||
}
|
||||
|
||||
const cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
||||
|
||||
cachedTextDecoder.decode();
|
||||
|
||||
let cachedUint8Memory0 = new Uint8Array();
|
||||
|
||||
function getUint8Memory0() {
|
||||
if (cachedUint8Memory0.byteLength === 0) {
|
||||
cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
|
||||
}
|
||||
return cachedUint8Memory0;
|
||||
}
|
||||
|
||||
function getStringFromWasm0(ptr, len) {
|
||||
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
||||
}
|
||||
|
||||
let WASM_VECTOR_LEN = 0;
|
||||
|
||||
const cachedTextEncoder = new TextEncoder('utf-8');
|
||||
|
||||
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
|
||||
? function (arg, view) {
|
||||
return cachedTextEncoder.encodeInto(arg, view);
|
||||
}
|
||||
: function (arg, view) {
|
||||
const buf = cachedTextEncoder.encode(arg);
|
||||
view.set(buf);
|
||||
return {
|
||||
read: arg.length,
|
||||
written: buf.length
|
||||
};
|
||||
});
|
||||
|
||||
function passStringToWasm0(arg, malloc, realloc) {
|
||||
|
||||
if (realloc === undefined) {
|
||||
const buf = cachedTextEncoder.encode(arg);
|
||||
const ptr = malloc(buf.length);
|
||||
getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
|
||||
WASM_VECTOR_LEN = buf.length;
|
||||
return ptr;
|
||||
}
|
||||
|
||||
let len = arg.length;
|
||||
let ptr = malloc(len);
|
||||
|
||||
const mem = getUint8Memory0();
|
||||
|
||||
let offset = 0;
|
||||
|
||||
for (; offset < len; offset++) {
|
||||
const code = arg.charCodeAt(offset);
|
||||
if (code > 0x7F) break;
|
||||
mem[ptr + offset] = code;
|
||||
}
|
||||
|
||||
if (offset !== len) {
|
||||
if (offset !== 0) {
|
||||
arg = arg.slice(offset);
|
||||
}
|
||||
ptr = realloc(ptr, len, len = offset + arg.length * 3);
|
||||
const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
|
||||
const ret = encodeString(arg, view);
|
||||
|
||||
offset += ret.written;
|
||||
}
|
||||
|
||||
WASM_VECTOR_LEN = offset;
|
||||
return ptr;
|
||||
}
|
||||
|
||||
let cachedInt32Memory0 = new Int32Array();
|
||||
|
||||
function getInt32Memory0() {
|
||||
if (cachedInt32Memory0.byteLength === 0) {
|
||||
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
||||
}
|
||||
return cachedInt32Memory0;
|
||||
}
|
||||
/**
|
||||
* @param {string} id
|
||||
* @param {string} openid
|
||||
* @param {string} master_key
|
||||
* @param {string} salt
|
||||
* @param {string} pass
|
||||
* @returns {string}
|
||||
*/
|
||||
export function get_public_key(id, openid, master_key, salt, pass) {
|
||||
try {
|
||||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
||||
const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len0 = WASM_VECTOR_LEN;
|
||||
const ptr1 = passStringToWasm0(openid, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len1 = WASM_VECTOR_LEN;
|
||||
const ptr2 = passStringToWasm0(master_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len2 = WASM_VECTOR_LEN;
|
||||
const ptr3 = passStringToWasm0(salt, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len3 = WASM_VECTOR_LEN;
|
||||
const ptr4 = passStringToWasm0(pass, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len4 = WASM_VECTOR_LEN;
|
||||
wasm.get_public_key(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4);
|
||||
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
||||
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
||||
return getStringFromWasm0(r0, r1);
|
||||
} finally {
|
||||
wasm.__wbindgen_add_to_stack_pointer(16);
|
||||
wasm.__wbindgen_free(r0, r1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} id
|
||||
* @param {string} openid
|
||||
* @param {string} master_key
|
||||
* @param {string} salt
|
||||
* @param {string} pass
|
||||
* @returns {string}
|
||||
*/
|
||||
export function generate_sec_key(id, openid, master_key, salt, pass) {
|
||||
try {
|
||||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
||||
const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len0 = WASM_VECTOR_LEN;
|
||||
const ptr1 = passStringToWasm0(openid, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len1 = WASM_VECTOR_LEN;
|
||||
const ptr2 = passStringToWasm0(master_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len2 = WASM_VECTOR_LEN;
|
||||
const ptr3 = passStringToWasm0(salt, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len3 = WASM_VECTOR_LEN;
|
||||
const ptr4 = passStringToWasm0(pass, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len4 = WASM_VECTOR_LEN;
|
||||
wasm.generate_sec_key(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4);
|
||||
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
||||
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
||||
return getStringFromWasm0(r0, r1);
|
||||
} finally {
|
||||
wasm.__wbindgen_add_to_stack_pointer(16);
|
||||
wasm.__wbindgen_free(r0, r1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} id
|
||||
* @param {string} openid
|
||||
* @param {string} master_key
|
||||
* @param {string} salt
|
||||
* @param {string} pass
|
||||
* @param {string} msg
|
||||
* @returns {string}
|
||||
*/
|
||||
export function sign(id, openid, master_key, salt, pass, msg) {
|
||||
try {
|
||||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
||||
const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len0 = WASM_VECTOR_LEN;
|
||||
const ptr1 = passStringToWasm0(openid, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len1 = WASM_VECTOR_LEN;
|
||||
const ptr2 = passStringToWasm0(master_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len2 = WASM_VECTOR_LEN;
|
||||
const ptr3 = passStringToWasm0(salt, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len3 = WASM_VECTOR_LEN;
|
||||
const ptr4 = passStringToWasm0(pass, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len4 = WASM_VECTOR_LEN;
|
||||
const ptr5 = passStringToWasm0(msg, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len5 = WASM_VECTOR_LEN;
|
||||
wasm.sign(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5);
|
||||
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
||||
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
||||
return getStringFromWasm0(r0, r1);
|
||||
} finally {
|
||||
wasm.__wbindgen_add_to_stack_pointer(16);
|
||||
wasm.__wbindgen_free(r0, r1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} id
|
||||
* @param {string} openid
|
||||
* @param {string} master_key
|
||||
* @param {string} salt
|
||||
* @param {string} pass
|
||||
* @param {string} msg
|
||||
* @returns {string}
|
||||
*/
|
||||
export function sign_for_tran(id, openid, master_key, salt, pass, msg) {
|
||||
try {
|
||||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
||||
const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len0 = WASM_VECTOR_LEN;
|
||||
const ptr1 = passStringToWasm0(openid, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len1 = WASM_VECTOR_LEN;
|
||||
const ptr2 = passStringToWasm0(master_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len2 = WASM_VECTOR_LEN;
|
||||
const ptr3 = passStringToWasm0(salt, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len3 = WASM_VECTOR_LEN;
|
||||
const ptr4 = passStringToWasm0(pass, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len4 = WASM_VECTOR_LEN;
|
||||
const ptr5 = passStringToWasm0(msg, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len5 = WASM_VECTOR_LEN;
|
||||
wasm.sign_for_tran(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5);
|
||||
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
||||
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
||||
return getStringFromWasm0(r0, r1);
|
||||
} finally {
|
||||
wasm.__wbindgen_add_to_stack_pointer(16);
|
||||
wasm.__wbindgen_free(r0, r1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} content
|
||||
* @returns {string}
|
||||
*/
|
||||
export function keccak256_hash(content) {
|
||||
try {
|
||||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
||||
const ptr0 = passStringToWasm0(content, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len0 = WASM_VECTOR_LEN;
|
||||
wasm.keccak256_hash(retptr, ptr0, len0);
|
||||
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
||||
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
||||
return getStringFromWasm0(r0, r1);
|
||||
} finally {
|
||||
wasm.__wbindgen_add_to_stack_pointer(16);
|
||||
wasm.__wbindgen_free(r0, r1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} pass
|
||||
* @param {string} salt
|
||||
* @param {number} n
|
||||
* @param {number} r
|
||||
* @param {number} p
|
||||
* @param {number} size
|
||||
* @returns {string}
|
||||
*/
|
||||
export function generate_scrypt_hash(pass, salt, n, r, p, size) {
|
||||
try {
|
||||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
||||
const ptr0 = passStringToWasm0(pass, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len0 = WASM_VECTOR_LEN;
|
||||
const ptr1 = passStringToWasm0(salt, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len1 = WASM_VECTOR_LEN;
|
||||
wasm.generate_scrypt_hash(retptr, ptr0, len0, ptr1, len1, n, r, p, size);
|
||||
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
||||
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
||||
return getStringFromWasm0(r0, r1);
|
||||
} finally {
|
||||
wasm.__wbindgen_add_to_stack_pointer(16);
|
||||
wasm.__wbindgen_free(r0, r1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} id
|
||||
* @param {string} openid
|
||||
* @param {string} master_key
|
||||
* @param {string} salt
|
||||
* @param {string} pass
|
||||
* @returns {string}
|
||||
*/
|
||||
export function wget_address(id, openid, master_key, salt, pass) {
|
||||
try {
|
||||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
||||
const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len0 = WASM_VECTOR_LEN;
|
||||
const ptr1 = passStringToWasm0(openid, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len1 = WASM_VECTOR_LEN;
|
||||
const ptr2 = passStringToWasm0(master_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len2 = WASM_VECTOR_LEN;
|
||||
const ptr3 = passStringToWasm0(salt, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len3 = WASM_VECTOR_LEN;
|
||||
const ptr4 = passStringToWasm0(pass, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len4 = WASM_VECTOR_LEN;
|
||||
wasm.wget_address(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4);
|
||||
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
||||
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
||||
return getStringFromWasm0(r0, r1);
|
||||
} finally {
|
||||
wasm.__wbindgen_add_to_stack_pointer(16);
|
||||
wasm.__wbindgen_free(r0, r1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} id
|
||||
* @param {string} openid
|
||||
* @param {string} master_key
|
||||
* @param {string} salt
|
||||
* @param {string} pass
|
||||
* @param {string} msg
|
||||
* @returns {string}
|
||||
*/
|
||||
export function wencrypt(id, openid, master_key, salt, pass, msg) {
|
||||
try {
|
||||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
||||
const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len0 = WASM_VECTOR_LEN;
|
||||
const ptr1 = passStringToWasm0(openid, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len1 = WASM_VECTOR_LEN;
|
||||
const ptr2 = passStringToWasm0(master_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len2 = WASM_VECTOR_LEN;
|
||||
const ptr3 = passStringToWasm0(salt, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len3 = WASM_VECTOR_LEN;
|
||||
const ptr4 = passStringToWasm0(pass, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len4 = WASM_VECTOR_LEN;
|
||||
const ptr5 = passStringToWasm0(msg, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len5 = WASM_VECTOR_LEN;
|
||||
wasm.wencrypt(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5);
|
||||
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
||||
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
||||
return getStringFromWasm0(r0, r1);
|
||||
} finally {
|
||||
wasm.__wbindgen_add_to_stack_pointer(16);
|
||||
wasm.__wbindgen_free(r0, r1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} id
|
||||
* @param {string} openid
|
||||
* @param {string} master_key
|
||||
* @param {string} salt
|
||||
* @param {string} pass
|
||||
* @param {string} msg
|
||||
* @returns {string}
|
||||
*/
|
||||
export function wdecrypt(id, openid, master_key, salt, pass, msg) {
|
||||
try {
|
||||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
||||
const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len0 = WASM_VECTOR_LEN;
|
||||
const ptr1 = passStringToWasm0(openid, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len1 = WASM_VECTOR_LEN;
|
||||
const ptr2 = passStringToWasm0(master_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len2 = WASM_VECTOR_LEN;
|
||||
const ptr3 = passStringToWasm0(salt, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len3 = WASM_VECTOR_LEN;
|
||||
const ptr4 = passStringToWasm0(pass, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len4 = WASM_VECTOR_LEN;
|
||||
const ptr5 = passStringToWasm0(msg, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len5 = WASM_VECTOR_LEN;
|
||||
wasm.wdecrypt(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5);
|
||||
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
||||
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
||||
return getStringFromWasm0(r0, r1);
|
||||
} finally {
|
||||
wasm.__wbindgen_add_to_stack_pointer(16);
|
||||
wasm.__wbindgen_free(r0, r1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} content
|
||||
* @param {string} key
|
||||
* @returns {string}
|
||||
*/
|
||||
export function encrypt_content(content, key) {
|
||||
try {
|
||||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
||||
const ptr0 = passStringToWasm0(content, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len0 = WASM_VECTOR_LEN;
|
||||
const ptr1 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len1 = WASM_VECTOR_LEN;
|
||||
wasm.encrypt_content(retptr, ptr0, len0, ptr1, len1);
|
||||
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
||||
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
||||
return getStringFromWasm0(r0, r1);
|
||||
} finally {
|
||||
wasm.__wbindgen_add_to_stack_pointer(16);
|
||||
wasm.__wbindgen_free(r0, r1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} content
|
||||
* @param {string} key
|
||||
* @returns {string}
|
||||
*/
|
||||
export function decrypt_content(content, key) {
|
||||
try {
|
||||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
||||
const ptr0 = passStringToWasm0(content, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len0 = WASM_VECTOR_LEN;
|
||||
const ptr1 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len1 = WASM_VECTOR_LEN;
|
||||
wasm.decrypt_content(retptr, ptr0, len0, ptr1, len1);
|
||||
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
||||
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
||||
return getStringFromWasm0(r0, r1);
|
||||
} finally {
|
||||
wasm.__wbindgen_add_to_stack_pointer(16);
|
||||
wasm.__wbindgen_free(r0, r1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} content
|
||||
* @param {string} key
|
||||
* @returns {string}
|
||||
*/
|
||||
export function aes_encrypt(content, key) {
|
||||
try {
|
||||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
||||
const ptr0 = passStringToWasm0(content, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len0 = WASM_VECTOR_LEN;
|
||||
const ptr1 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len1 = WASM_VECTOR_LEN;
|
||||
wasm.aes_encrypt(retptr, ptr0, len0, ptr1, len1);
|
||||
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
||||
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
||||
return getStringFromWasm0(r0, r1);
|
||||
} finally {
|
||||
wasm.__wbindgen_add_to_stack_pointer(16);
|
||||
wasm.__wbindgen_free(r0, r1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} content
|
||||
* @param {string} key
|
||||
* @returns {string}
|
||||
*/
|
||||
export function aes_decrypt(content, key) {
|
||||
try {
|
||||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
||||
const ptr0 = passStringToWasm0(content, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len0 = WASM_VECTOR_LEN;
|
||||
const ptr1 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len1 = WASM_VECTOR_LEN;
|
||||
wasm.aes_decrypt(retptr, ptr0, len0, ptr1, len1);
|
||||
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
||||
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
||||
return getStringFromWasm0(r0, r1);
|
||||
} finally {
|
||||
wasm.__wbindgen_add_to_stack_pointer(16);
|
||||
wasm.__wbindgen_free(r0, r1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} pk
|
||||
* @param {string} msg
|
||||
* @returns {string}
|
||||
*/
|
||||
export function rencrypt(pk, msg) {
|
||||
try {
|
||||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
||||
const ptr0 = passStringToWasm0(pk, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len0 = WASM_VECTOR_LEN;
|
||||
const ptr1 = passStringToWasm0(msg, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len1 = WASM_VECTOR_LEN;
|
||||
wasm.rencrypt(retptr, ptr0, len0, ptr1, len1);
|
||||
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
||||
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
||||
return getStringFromWasm0(r0, r1);
|
||||
} finally {
|
||||
wasm.__wbindgen_add_to_stack_pointer(16);
|
||||
wasm.__wbindgen_free(r0, r1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} sk
|
||||
* @param {string} msg
|
||||
* @returns {string}
|
||||
*/
|
||||
export function rdecrypt(sk, msg) {
|
||||
try {
|
||||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
||||
const ptr0 = passStringToWasm0(sk, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len0 = WASM_VECTOR_LEN;
|
||||
const ptr1 = passStringToWasm0(msg, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len1 = WASM_VECTOR_LEN;
|
||||
wasm.rdecrypt(retptr, ptr0, len0, ptr1, len1);
|
||||
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
||||
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
||||
return getStringFromWasm0(r0, r1);
|
||||
} finally {
|
||||
wasm.__wbindgen_add_to_stack_pointer(16);
|
||||
wasm.__wbindgen_free(r0, r1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} content
|
||||
* @returns {string}
|
||||
*/
|
||||
export function generate_qr(content) {
|
||||
try {
|
||||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
||||
const ptr0 = passStringToWasm0(content, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len0 = WASM_VECTOR_LEN;
|
||||
wasm.generate_qr(retptr, ptr0, len0);
|
||||
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
||||
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
||||
return getStringFromWasm0(r0, r1);
|
||||
} finally {
|
||||
wasm.__wbindgen_add_to_stack_pointer(16);
|
||||
wasm.__wbindgen_free(r0, r1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} content
|
||||
* @returns {string}
|
||||
*/
|
||||
export function hex_deflate(content) {
|
||||
try {
|
||||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
||||
const ptr0 = passStringToWasm0(content, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len0 = WASM_VECTOR_LEN;
|
||||
wasm.hex_deflate(retptr, ptr0, len0);
|
||||
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
||||
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
||||
return getStringFromWasm0(r0, r1);
|
||||
} finally {
|
||||
wasm.__wbindgen_add_to_stack_pointer(16);
|
||||
wasm.__wbindgen_free(r0, r1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} content
|
||||
* @returns {string}
|
||||
*/
|
||||
export function hex_inflate(content) {
|
||||
try {
|
||||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
||||
const ptr0 = passStringToWasm0(content, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len0 = WASM_VECTOR_LEN;
|
||||
wasm.hex_inflate(retptr, ptr0, len0);
|
||||
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
||||
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
||||
return getStringFromWasm0(r0, r1);
|
||||
} finally {
|
||||
wasm.__wbindgen_add_to_stack_pointer(16);
|
||||
wasm.__wbindgen_free(r0, r1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} pass
|
||||
* @param {string} salt
|
||||
* @returns {string}
|
||||
*/
|
||||
export function password_hash(pass, salt) {
|
||||
try {
|
||||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
||||
const ptr0 = passStringToWasm0(pass, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len0 = WASM_VECTOR_LEN;
|
||||
const ptr1 = passStringToWasm0(salt, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len1 = WASM_VECTOR_LEN;
|
||||
wasm.password_hash(retptr, ptr0, len0, ptr1, len1);
|
||||
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
||||
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
||||
return getStringFromWasm0(r0, r1);
|
||||
} finally {
|
||||
wasm.__wbindgen_add_to_stack_pointer(16);
|
||||
wasm.__wbindgen_free(r0, r1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} content
|
||||
* @returns {string}
|
||||
*/
|
||||
export function hash_pass_svr(content) {
|
||||
try {
|
||||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
||||
const ptr0 = passStringToWasm0(content, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len0 = WASM_VECTOR_LEN;
|
||||
wasm.hash_pass_svr(retptr, ptr0, len0);
|
||||
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
||||
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
||||
return getStringFromWasm0(r0, r1);
|
||||
} finally {
|
||||
wasm.__wbindgen_add_to_stack_pointer(16);
|
||||
wasm.__wbindgen_free(r0, r1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} pass
|
||||
* @param {string} pass_hash
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function password_verify(pass, pass_hash) {
|
||||
const ptr0 = passStringToWasm0(pass, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len0 = WASM_VECTOR_LEN;
|
||||
const ptr1 = passStringToWasm0(pass_hash, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len1 = WASM_VECTOR_LEN;
|
||||
const ret = wasm.password_verify(ptr0, len0, ptr1, len1);
|
||||
return ret !== 0;
|
||||
}
|
||||
|
||||
function handleError(f, args) {
|
||||
try {
|
||||
return f.apply(this, args);
|
||||
} catch (e) {
|
||||
wasm.__wbindgen_exn_store(addHeapObject(e));
|
||||
}
|
||||
}
|
||||
|
||||
function getArrayU8FromWasm0(ptr, len) {
|
||||
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
|
||||
}
|
||||
|
||||
async function load(module, imports) {
|
||||
if (typeof Response === 'function' && module instanceof Response) {
|
||||
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
||||
try {
|
||||
return await WebAssembly.instantiateStreaming(module, imports);
|
||||
|
||||
} catch (e) {
|
||||
if (module.headers.get('Content-Type') != 'application/wasm') {
|
||||
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
||||
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const bytes = await module.arrayBuffer();
|
||||
return await WebAssembly.instantiate(bytes, imports);
|
||||
|
||||
} else {
|
||||
const instance = await WebAssembly.instantiate(module, imports);
|
||||
|
||||
if (instance instanceof WebAssembly.Instance) {
|
||||
return { instance, module };
|
||||
|
||||
} else {
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getImports() {
|
||||
const imports = {};
|
||||
imports.wbg = {};
|
||||
imports.wbg.__wbg_randomFillSync_065afffde01daa66 = function() { return handleError(function (arg0, arg1, arg2) {
|
||||
getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2));
|
||||
}, arguments) };
|
||||
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
|
||||
takeObject(arg0);
|
||||
};
|
||||
imports.wbg.__wbg_getRandomValues_b99eec4244a475bb = function() { return handleError(function (arg0, arg1) {
|
||||
getObject(arg0).getRandomValues(getObject(arg1));
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_process_0cc2ada8524d6f83 = function(arg0) {
|
||||
const ret = getObject(arg0).process;
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbindgen_is_object = function(arg0) {
|
||||
const val = getObject(arg0);
|
||||
const ret = typeof(val) === 'object' && val !== null;
|
||||
return ret;
|
||||
};
|
||||
imports.wbg.__wbg_versions_c11acceab27a6c87 = function(arg0) {
|
||||
const ret = getObject(arg0).versions;
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbg_node_7ff1ce49caf23815 = function(arg0) {
|
||||
const ret = getObject(arg0).node;
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbindgen_is_string = function(arg0) {
|
||||
const ret = typeof(getObject(arg0)) === 'string';
|
||||
return ret;
|
||||
};
|
||||
imports.wbg.__wbg_crypto_2036bed7c44c25e7 = function(arg0) {
|
||||
const ret = getObject(arg0).crypto;
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbg_msCrypto_a21fc88caf1ecdc8 = function(arg0) {
|
||||
const ret = getObject(arg0).msCrypto;
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbg_static_accessor_NODE_MODULE_cf6401cc1091279e = function() {
|
||||
const ret = module;
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbg_require_a746e79b322b9336 = function() { return handleError(function (arg0, arg1, arg2) {
|
||||
const ret = getObject(arg0).require(getStringFromWasm0(arg1, arg2));
|
||||
return addHeapObject(ret);
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_newnoargs_b5b063fc6c2f0376 = function(arg0, arg1) {
|
||||
const ret = new Function(getStringFromWasm0(arg0, arg1));
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbg_call_97ae9d8645dc388b = function() { return handleError(function (arg0, arg1) {
|
||||
const ret = getObject(arg0).call(getObject(arg1));
|
||||
return addHeapObject(ret);
|
||||
}, arguments) };
|
||||
imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
|
||||
const ret = getObject(arg0);
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbg_self_6d479506f72c6a71 = function() { return handleError(function () {
|
||||
const ret = self.self;
|
||||
return addHeapObject(ret);
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_window_f2557cc78490aceb = function() { return handleError(function () {
|
||||
const ret = window.window;
|
||||
return addHeapObject(ret);
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_globalThis_7f206bda628d5286 = function() { return handleError(function () {
|
||||
const ret = globalThis.globalThis;
|
||||
return addHeapObject(ret);
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_global_ba75c50d1cf384f4 = function() { return handleError(function () {
|
||||
const ret = global.global;
|
||||
return addHeapObject(ret);
|
||||
}, arguments) };
|
||||
imports.wbg.__wbindgen_is_undefined = function(arg0) {
|
||||
const ret = getObject(arg0) === undefined;
|
||||
return ret;
|
||||
};
|
||||
imports.wbg.__wbg_buffer_3f3d764d4747d564 = function(arg0) {
|
||||
const ret = getObject(arg0).buffer;
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbg_new_8c3f0052272a457a = function(arg0) {
|
||||
const ret = new Uint8Array(getObject(arg0));
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbg_set_83db9690f9353e79 = function(arg0, arg1, arg2) {
|
||||
getObject(arg0).set(getObject(arg1), arg2 >>> 0);
|
||||
};
|
||||
imports.wbg.__wbg_length_9e1ae1900cb0fbd5 = function(arg0) {
|
||||
const ret = getObject(arg0).length;
|
||||
return ret;
|
||||
};
|
||||
imports.wbg.__wbg_newwithlength_f5933855e4f48a19 = function(arg0) {
|
||||
const ret = new Uint8Array(arg0 >>> 0);
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbg_subarray_58ad4efbb5bcb886 = function(arg0, arg1, arg2) {
|
||||
const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbindgen_throw = function(arg0, arg1) {
|
||||
throw new Error(getStringFromWasm0(arg0, arg1));
|
||||
};
|
||||
imports.wbg.__wbindgen_memory = function() {
|
||||
const ret = wasm.memory;
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
|
||||
return imports;
|
||||
}
|
||||
|
||||
function initMemory(imports, maybe_memory) {
|
||||
|
||||
}
|
||||
|
||||
function finalizeInit(instance, module) {
|
||||
wasm = instance.exports;
|
||||
init.__wbindgen_wasm_module = module;
|
||||
cachedInt32Memory0 = new Int32Array();
|
||||
cachedUint8Memory0 = new Uint8Array();
|
||||
|
||||
|
||||
return wasm;
|
||||
}
|
||||
|
||||
function initSync(module) {
|
||||
const imports = getImports();
|
||||
|
||||
initMemory(imports);
|
||||
|
||||
if (!(module instanceof WebAssembly.Module)) {
|
||||
module = new WebAssembly.Module(module);
|
||||
}
|
||||
|
||||
const instance = new WebAssembly.Instance(module, imports);
|
||||
|
||||
return finalizeInit(instance, module);
|
||||
}
|
||||
|
||||
async function init(input) {
|
||||
if (typeof input === 'undefined') {
|
||||
input = new URL('rustwallet_bg.wasm', import.meta.url);
|
||||
}
|
||||
const imports = getImports();
|
||||
|
||||
if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
|
||||
input = fetch(input);
|
||||
}
|
||||
|
||||
initMemory(imports);
|
||||
|
||||
const { instance, module } = await load(await input, imports);
|
||||
|
||||
return finalizeInit(instance, module);
|
||||
}
|
||||
|
||||
export { initSync }
|
||||
export default init;
|
BIN
public/js-assets/wasm/rustwallet_bg.wasm
Normal file
33
public/js-assets/wasm/rustwallet_bg.wasm.d.ts
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
export const memory: WebAssembly.Memory;
|
||||
export function get_public_key(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number): void;
|
||||
export function generate_sec_key(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number): void;
|
||||
export function sign(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number): void;
|
||||
export function sign_for_tran(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number): void;
|
||||
export function keccak256_hash(a: number, b: number, c: number): void;
|
||||
export function generate_scrypt_hash(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number): void;
|
||||
export function wget_address(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number): void;
|
||||
export function wencrypt(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number): void;
|
||||
export function wdecrypt(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number): void;
|
||||
export function encrypt_content(a: number, b: number, c: number, d: number, e: number): void;
|
||||
export function decrypt_content(a: number, b: number, c: number, d: number, e: number): void;
|
||||
export function aes_encrypt(a: number, b: number, c: number, d: number, e: number): void;
|
||||
export function aes_decrypt(a: number, b: number, c: number, d: number, e: number): void;
|
||||
export function rencrypt(a: number, b: number, c: number, d: number, e: number): void;
|
||||
export function rdecrypt(a: number, b: number, c: number, d: number, e: number): void;
|
||||
export function generate_qr(a: number, b: number, c: number): void;
|
||||
export function hex_deflate(a: number, b: number, c: number): void;
|
||||
export function hex_inflate(a: number, b: number, c: number): void;
|
||||
export function password_hash(a: number, b: number, c: number, d: number, e: number): void;
|
||||
export function hash_pass_svr(a: number, b: number, c: number): void;
|
||||
export function password_verify(a: number, b: number, c: number, d: number): number;
|
||||
export function rustsecp256k1_v0_7_0_context_create(a: number): number;
|
||||
export function rustsecp256k1_v0_7_0_context_destroy(a: number): void;
|
||||
export function rustsecp256k1_v0_7_0_default_illegal_callback_fn(a: number, b: number): void;
|
||||
export function rustsecp256k1_v0_7_0_default_error_callback_fn(a: number, b: number): void;
|
||||
export function __wbindgen_add_to_stack_pointer(a: number): number;
|
||||
export function __wbindgen_malloc(a: number): number;
|
||||
export function __wbindgen_realloc(a: number, b: number, c: number): number;
|
||||
export function __wbindgen_free(a: number, b: number): void;
|
||||
export function __wbindgen_exn_store(a: number): void;
|
BIN
public/logo.png
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 15 KiB |
94
src/App.vue
@ -12,6 +12,7 @@ import Notification from './components/global/Notification.vue'
|
||||
import { gsap } from "gsap";
|
||||
|
||||
import { ScrollTrigger } from "gsap/ScrollTrigger";
|
||||
import { BlockChain } from '@/components/chain/BlockChain';
|
||||
|
||||
gsap.registerPlugin(ScrollTrigger);
|
||||
|
||||
@ -21,11 +22,16 @@ const notification = ref(null);
|
||||
provide('addNotification', (title, message) => {
|
||||
notification.value.addNotification(title, message);
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
new BlockChain().preparePassport();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
body,
|
||||
html {
|
||||
background-color: #17141B;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
height: 100%;
|
||||
@ -60,13 +66,93 @@ html {
|
||||
.fade-leave-to {
|
||||
opacity: 0;
|
||||
}
|
||||
@font-face {
|
||||
font-family: "MyFont";
|
||||
src: url("/fonts/myfont.ttf") format("truetype");
|
||||
}
|
||||
// @font-face {
|
||||
// font-family: "MyFont";
|
||||
// src: url("/fonts/myfont.ttf") format("truetype");
|
||||
// "@vueuse/core": "^9.12.0",
|
||||
|
||||
// }
|
||||
#app{
|
||||
height: 100%;
|
||||
position: relative;
|
||||
//background: #0c0c18;
|
||||
}
|
||||
div,
|
||||
span,
|
||||
object,
|
||||
iframe,
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6,
|
||||
p,
|
||||
blockquote,
|
||||
pre,
|
||||
abbr,
|
||||
address,
|
||||
cite,
|
||||
code,
|
||||
del,
|
||||
dfn,
|
||||
em,
|
||||
img,
|
||||
ins,
|
||||
kbd,
|
||||
q,
|
||||
samp,
|
||||
small,
|
||||
strong,
|
||||
sub,
|
||||
sup,
|
||||
var,
|
||||
b,
|
||||
i,
|
||||
dl,
|
||||
dt,
|
||||
dd,
|
||||
ol,
|
||||
ul,
|
||||
li,
|
||||
fieldset,
|
||||
form,
|
||||
label,
|
||||
legend,
|
||||
table,
|
||||
caption,
|
||||
tbody,
|
||||
tfoot,
|
||||
thead,
|
||||
tr,
|
||||
th,
|
||||
td,
|
||||
article,
|
||||
aside,
|
||||
canvas,
|
||||
details,
|
||||
figcaption,
|
||||
figure,
|
||||
footer,
|
||||
header,
|
||||
hgroup,
|
||||
menu,
|
||||
nav,
|
||||
section,
|
||||
summary,
|
||||
time,
|
||||
mark,
|
||||
audio,
|
||||
video {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
outline: 0;
|
||||
font-size: 100%;
|
||||
vertical-align: baseline;
|
||||
background: transparent;
|
||||
list-style: none;
|
||||
word-break: keep-all;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
</style>
|
||||
|
@ -1,5 +1,7 @@
|
||||
import request from '@/utils/request'
|
||||
import request2 from '@/utils/requestduplicate'
|
||||
import request3 from '@/utils/request3'
|
||||
|
||||
|
||||
|
||||
const GPAL_URL = import.meta.env.VUE_APP_GPAL_API;
|
||||
@ -109,3 +111,10 @@ export const getNonce = (params) =>
|
||||
method: 'get',
|
||||
params: params
|
||||
})
|
||||
|
||||
export const getlogin = (params) =>
|
||||
request3({
|
||||
url: "/webapp/index.php?c=Login&a=auth&_is_web=1",
|
||||
method: "get",
|
||||
params: params,
|
||||
})
|
||||
|
0
src/api/marketplace.js
Normal file
BIN
src/assets/img/about/gameWeb_aboutP1_bg1.png
Normal file
After Width: | Height: | Size: 1.1 MiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 235 KiB After Width: | Height: | Size: 243 KiB |
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 5.9 KiB |
Before Width: | Height: | Size: 698 B After Width: | Height: | Size: 374 B |
Before Width: | Height: | Size: 161 B After Width: | Height: | Size: 159 B |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 202 KiB After Width: | Height: | Size: 462 KiB |
BIN
src/assets/img/about/gameWeb_aboutP3_roadmap.png
Normal file
After Width: | Height: | Size: 1.6 MiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 313 KiB After Width: | Height: | Size: 338 KiB |
Before Width: | Height: | Size: 8.9 KiB After Width: | Height: | Size: 9.6 KiB |
Before Width: | Height: | Size: 356 KiB After Width: | Height: | Size: 252 KiB |
Before Width: | Height: | Size: 463 KiB After Width: | Height: | Size: 105 KiB |
Before Width: | Height: | Size: 403 KiB After Width: | Height: | Size: 274 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 842 KiB After Width: | Height: | Size: 914 KiB |
BIN
src/assets/img/cec_activity/CEC_chest.png
Normal file
After Width: | Height: | Size: 742 KiB |
BIN
src/assets/img/cec_activity/ConnectMenu1.png
Normal file
After Width: | Height: | Size: 6.3 KiB |
BIN
src/assets/img/cec_activity/ConnectMenu2.png
Normal file
After Width: | Height: | Size: 6.3 KiB |
BIN
src/assets/img/cec_activity/CounterFireLogo.png
Normal file
After Width: | Height: | Size: 4.9 KiB |
BIN
src/assets/img/cec_activity/Credit_bg1.png
Normal file
After Width: | Height: | Size: 9.2 KiB |
BIN
src/assets/img/cec_activity/Credit_bg3.png
Normal file
After Width: | Height: | Size: 7.2 KiB |
BIN
src/assets/img/cec_activity/Discord.png
Normal file
After Width: | Height: | Size: 900 B |
BIN
src/assets/img/cec_activity/Icon_Disc.png
Normal file
After Width: | Height: | Size: 460 B |
BIN
src/assets/img/cec_activity/Icon_X.png
Normal file
After Width: | Height: | Size: 516 B |
BIN
src/assets/img/cec_activity/X.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
src/assets/img/cec_activity/andriod.png
Normal file
After Width: | Height: | Size: 4.9 KiB |
BIN
src/assets/img/cec_activity/btn_appStore.png
Normal file
After Width: | Height: | Size: 8.1 KiB |
BIN
src/assets/img/cec_activity/btn_googlePlay.png
Normal file
After Width: | Height: | Size: 8.6 KiB |
BIN
src/assets/img/cec_activity/com_Discord_icon.png
Normal file
After Width: | Height: | Size: 1005 B |
BIN
src/assets/img/cec_activity/com_X_icon.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
src/assets/img/cec_activity/com_Youtube_icon.png
Normal file
After Width: | Height: | Size: 695 B |
BIN
src/assets/img/cec_activity/credit_bg2.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
src/assets/img/cec_activity/event_help.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
src/assets/img/cec_activity/game_logo02.png
Normal file
After Width: | Height: | Size: 4.0 KiB |
BIN
src/assets/img/cec_activity/icon_Credit_big.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
src/assets/img/cec_activity/mint_Logo1.png
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
src/assets/img/cec_activity/mint_Logo2.png
Normal file
After Width: | Height: | Size: 21 KiB |
BIN
src/assets/img/cec_activity/totalCEC_bg.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
src/assets/img/cec_claim/Bg_chest.png
Normal file
After Width: | Height: | Size: 71 KiB |
BIN
src/assets/img/cec_claim/Bitgetlogo.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
src/assets/img/cec_claim/CEC_ICON.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
src/assets/img/cec_claim/Counterfire_History_icon.png
Normal file
After Width: | Height: | Size: 4.0 KiB |
BIN
src/assets/img/cec_claim/Counterfire_bg.png
Normal file
After Width: | Height: | Size: 314 KiB |
BIN
src/assets/img/cec_claim/Counterfire_bg01.png
Normal file
After Width: | Height: | Size: 5.9 KiB |
BIN
src/assets/img/cec_claim/Counterfire_mbg01.png
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
src/assets/img/cec_claim/Counterfire_mbg02.png
Normal file
After Width: | Height: | Size: 5.3 KiB |
BIN
src/assets/img/cec_claim/HistoryTxt.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
src/assets/img/cec_claim/Whitelist.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
src/assets/img/cec_claim/scene_bg.jpg
Normal file
After Width: | Height: | Size: 175 KiB |
BIN
src/assets/img/home/BG01.png
Normal file
After Width: | Height: | Size: 210 KiB |
Before Width: | Height: | Size: 416 KiB After Width: | Height: | Size: 454 KiB |
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 42 KiB |
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 42 KiB |
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 41 KiB |
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 41 KiB |
Before Width: | Height: | Size: 8.3 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 53 KiB After Width: | Height: | Size: 41 KiB |
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 42 KiB |
Before Width: | Height: | Size: 53 KiB After Width: | Height: | Size: 41 KiB |
Before Width: | Height: | Size: 53 KiB After Width: | Height: | Size: 41 KiB |
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 40 KiB |
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 40 KiB |
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 42 KiB |
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 40 KiB |