update js lib
This commit is contained in:
parent
e16849ddb9
commit
ea99fc54e2
104
js/main.js
104
js/main.js
@ -6,7 +6,9 @@ console.log(">>begin load wallet main file");
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
function initWallet(funId, type, chain) {
|
function initWallet(funId, type, chain) {
|
||||||
chain = chain || 80001
|
// chain = chain || 80001
|
||||||
|
type = 0
|
||||||
|
chain = 1338
|
||||||
try {
|
try {
|
||||||
var wallet;
|
var wallet;
|
||||||
if (!window.jc || !jc.wallet) {
|
if (!window.jc || !jc.wallet) {
|
||||||
@ -161,28 +163,40 @@ function createAccount(funId) {
|
|||||||
* @return {string} account actived
|
* @return {string} account actived
|
||||||
*/
|
*/
|
||||||
function importAccount(funId, privateKey) {
|
function importAccount(funId, privateKey) {
|
||||||
try {
|
// try {
|
||||||
let address = jc.wallet.importAccount(privateKey);
|
// let address = jc.wallet.importAccount(privateKey);
|
||||||
return JSON.stringify({
|
// return JSON.stringify({
|
||||||
errcode: 0,
|
// errcode: 0,
|
||||||
data: address,
|
// data: address,
|
||||||
|
// });
|
||||||
|
// } catch (err) {
|
||||||
|
// return JSON.stringify({
|
||||||
|
// errcode: 1,
|
||||||
|
// errmsg: err,
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
let addresses = ["0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1","0xCd36bFD6f5c9685A5b1DD953E8279eeC7d41e1E1","0xb3212b66C337F83D277172D891Daf31776FF9D79"]
|
||||||
|
let values = ["1024168356010420","0","110241683560010039000000000000000134390000000000000003020000000000000000000000","1667381156"]
|
||||||
|
let signature = '0x5788bc2812b31165aff7c344321076b55d61f84ee1cb064f12fac3cea7cfbbd03f180a2228b4cce665a00d52fd08c10e3e09d1bf22a008c999bd72dcb372f6fb1b'
|
||||||
|
jc.wallet.jcStandard
|
||||||
|
.buyNft721({
|
||||||
|
addresses,
|
||||||
|
values,
|
||||||
|
signature,
|
||||||
|
})
|
||||||
|
.then((result) => {
|
||||||
|
jsb.jcCallback(
|
||||||
|
funId,
|
||||||
|
JSON.stringify({
|
||||||
|
errcode: 0,
|
||||||
|
data: result,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.log(JSON.stringify(err))
|
||||||
|
jsb.jcCallback(funId,JSON.stringify({errcode: 1,errmsg: err}));
|
||||||
});
|
});
|
||||||
} catch (err) {
|
|
||||||
return JSON.stringify({
|
|
||||||
errcode: 1,
|
|
||||||
errmsg: err,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// jc.wallet.erc20Standard.transfer({
|
|
||||||
// address: '0xC76c692450d6221A8B1E035CB8bdB639bC60658D',
|
|
||||||
// from: '0x50A8e60041A206AcaA5F844a1104896224be6F39',
|
|
||||||
// to: '0x746338765a8FbDD1c5aB61bfb92CD6D960C3C662',
|
|
||||||
// amount: 101
|
|
||||||
// }).then((res) => {
|
|
||||||
// console.log(JSON.stringify(res))
|
|
||||||
// }).catch(err => {
|
|
||||||
// console.log(JSON.stringify(err))
|
|
||||||
// })
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* active one account
|
* active one account
|
||||||
@ -386,6 +400,9 @@ function signOutGoogle(funId) {
|
|||||||
//}
|
//}
|
||||||
|
|
||||||
function buyNft721(funId, addresses, values, signature) {
|
function buyNft721(funId, addresses, values, signature) {
|
||||||
|
addresses = ["0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1","0xCd36bFD6f5c9685A5b1DD953E8279eeC7d41e1E1","0xb3212b66C337F83D277172D891Daf31776FF9D79"]
|
||||||
|
values = ["1024168356010499","0","110241683560010039000000000000000134390000000000000003020000000000000000000000","1667381156"]
|
||||||
|
signature = '0x4278d777d25fa96bb9733dd6c924adf9a79a88de60c684894f29f02c739ff79231d62ecd10d9a07121d88f6719f6b49814fc2e9438a03a46e6bf0def5c1e3ad71b'
|
||||||
jc.wallet.jcStandard
|
jc.wallet.jcStandard
|
||||||
.buyNft721({
|
.buyNft721({
|
||||||
addresses,
|
addresses,
|
||||||
@ -549,4 +566,47 @@ function shardMixByUser(
|
|||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
jsb.jcCallback(funId,JSON.stringify({errcode: 1,errmsg: err}));
|
jsb.jcCallback(funId,JSON.stringify({errcode: 1,errmsg: err}));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function pluginChip(
|
||||||
|
funId,
|
||||||
|
nftAddress,
|
||||||
|
chipAddress,
|
||||||
|
nftId,
|
||||||
|
chipIds
|
||||||
|
) {
|
||||||
|
jc.wallet.jcStandard
|
||||||
|
.pluginChip({
|
||||||
|
nftAddress,
|
||||||
|
chipAddress,
|
||||||
|
nftId,
|
||||||
|
chipIds
|
||||||
|
})
|
||||||
|
.then((result) => {
|
||||||
|
jsb.jcCallback(funId,JSON.stringify({errcode: 0,data: result}));
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
jsb.jcCallback(funId,JSON.stringify({errcode: 1,errmsg: err}));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function unplugChip(
|
||||||
|
funId,
|
||||||
|
nftAddress,
|
||||||
|
chipAddress,
|
||||||
|
nftId,
|
||||||
|
chipIds
|
||||||
|
) {
|
||||||
|
jc.wallet.jcStandard
|
||||||
|
.unplugChip({
|
||||||
|
nftAddress,
|
||||||
|
chipAddress,
|
||||||
|
nftId,
|
||||||
|
chipIds
|
||||||
|
})
|
||||||
|
.then((result) => {
|
||||||
|
jsb.jcCallback(funId,JSON.stringify({errcode: 0,data: result}));
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
jsb.jcCallback(funId,JSON.stringify({errcode: 1,errmsg: err}));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user