54 lines
1.6 KiB
JavaScript
54 lines
1.6 KiB
JavaScript
System.register(["__unresolved_0", "cc", "web3/dist/web3.min.js"], function (_export, _context) {
|
|
"use strict";
|
|
|
|
var _reporterNs, _cclegacy, Web3, _crd, web3;
|
|
|
|
async function createNft(params) {
|
|
if (params.toAddress === "" || params.toAddress === null || params.toAddress === undefined) {
|
|
params.toAddress = web3.eth.defaultAccount;
|
|
}
|
|
|
|
const contract = new web3.eth.Contract(eval("(" + params.abi + ")"), params.address);
|
|
await contract.methods.Mint(params.toAddress, params.token_id).send({
|
|
from: web3.eth.defaultAccount
|
|
}), function (error, transactionHash) {
|
|
if (!error) {
|
|
return transactionHash;
|
|
} else {
|
|
console.log(error);
|
|
}
|
|
};
|
|
}
|
|
|
|
function _reportPossibleCrUseOfWeb(extras) {
|
|
_reporterNs.report("Web3", "web3/dist/web3.min.js", _context.meta, extras);
|
|
}
|
|
|
|
_export("createNft", createNft);
|
|
|
|
return {
|
|
setters: [function (_unresolved_) {
|
|
_reporterNs = _unresolved_;
|
|
}, function (_cc) {
|
|
_cclegacy = _cc.cclegacy;
|
|
}, function (_web3DistWeb3MinJs) {
|
|
Web3 = _web3DistWeb3MinJs.default;
|
|
}],
|
|
execute: function () {
|
|
_crd = true;
|
|
|
|
_cclegacy._RF.push({}, "2741axHfMlDUbRCZMaHJZxs", "web3", undefined);
|
|
|
|
_export("web3", web3 = new (_crd && Web3 === void 0 ? (_reportPossibleCrUseOfWeb({
|
|
error: Error()
|
|
}), Web3) : Web3)((_crd && Web3 === void 0 ? (_reportPossibleCrUseOfWeb({
|
|
error: Error()
|
|
}), Web3) : Web3).givenProvider));
|
|
|
|
_cclegacy._RF.pop();
|
|
|
|
_crd = false;
|
|
}
|
|
};
|
|
});
|
|
//# sourceMappingURL=9fc1643aa76bf9703b6305406d25b86e91b514c4.js.map
|