I am going to send usdt token in game using metamask.
I am using cocos creator v3.7.3, so language is typescript.
I tried to use nodejs module, but in cocos creator console, a error message like “Cannot destructure property ‘uint8ArrayToHexString’ of ‘validatorutils’ as it is undefined” is occured.
So can’t run and build.
How can I do this?
I hope your help…
Thanks.
I haven’t learned how to connect wallets to Cocos Creator games yet but when I do I’ll have a tutorial for it. Can you send a screenshot of the error and the script file where the SDK is imported?
import Web3 from ‘web3’;
const { ccclass, property } = _decorator;
@ccclass(‘LobbyController’)
export class LobbyController extends Component {
...
async onLoad() {
if (window["ethereum"] != undefined && window["ethereum"] != null) {
const web3 = new Web3(window["ethereum"]);
}
}
}
Hey sorry for the late response, was studying how to do it myself. I noticed you imported “web3” instead of the MetaMaskSDK
why is that? and were you able to bring up the metamask extension at all?