Hi guys!
I have updated my faucet page on SwayLend app to multi token contract and mint
fn doesn’t work when I use wallet instance, it fails with next error and not even open extension to sign tx
Error: Unknown field "status" on type "Message".: {"response":{"data":null,"errors":[{"message":"Unknown field \"status\" on type \"Message\".","locations":[{"line":28,"column":3}]},{"message":"Unknown field \"status\" on type \"Coin\".","locations":[{"line":18,"column":3}]},{"message":"Unknown field \"resourcesToSpend\" on type \"Query\". Did you mean \"coinsToSpend\"?","locations":[{"line":2,"column":3}]}],"status":200,"headers":{"map":{"content-type":"application/json"}}},"request":{"query":"query getResourcesToSpend($owner: Address!, $queryPerAsset: [SpendQueryElementInput!]!, $excludedIds: ExcludeInput) {\n resourcesToSpend(\n owner: $owner\n queryPerAsset: $queryPerAsset\n excludedIds: $excludedIds\n ) {\n ...coinFragment\n ...messageFragment\n }\n}\n\nfragment coinFragment on Coin {\n utxoId\n owner\n amount\n assetId\n maturity\n coinStatus: status\n blockCreated\n}\n\nfragment messageFragment on Message {\n amount\n sender\n recipient\n data\n nonce\n messageStatus: status\n daHeight\n}","variables":{"owner":"0xf544349bc57a4fb57e9af1de2c4415a39b57856fe8c76263f040806095734ec1","queryPerAsset":[{"assetId":"0x0000000000000000000000000000000000000000000000000000000000000000","amount":"2"}],"excludedIds":{"messages":[],"utxos":[]}}}}
I tried to change network to beta3 and it fails ofc too, because there is no tokens deployed with my address, but it at least opens wallet page where I can sign tx
I tried to pass wallet instance made with privateKey and it worked.
const wallet = Wallet.fromPrivateKey(
process.env.REACT_APP_SECRET!,
provider
);
Multi token code: GitHub - compolabs/src-20 at token-factory
Code with mint fn call:
import { TokenFactoryAbi__factory } from "@src/contracts";
import { hashMessage } from "fuels";
const wallet = window.fuel.getWallet(this.address);
const tokenFactoryContract = TokenFactoryAbi__factory.connect(
tokenFactory,
wallet
);
const hash = hashMessage("USDC"); //0x8591ee9090c0c02ca1f103cb637131d8f358870aba145245ff083e138fdd705b
const userAddress = wallet.address.toB256();//0xf544349bc57a4fb57e9af1de2c4415a39b57856fe8c76263f040806095734ec1
const { transactionResult } = await tokenFactoryContract.functions
.mint({ value: userAddress }, hash, "1000000")
.txParams({ gasPrice: 1 })
.call();
Token Factory deployed on beta4 :0xd8c627b9cd9ee42e2c2bd9793b13bc9f8e9aad32e25a99ea574f23c1dd17685a
Token Factory Abi :https://github.com/compolabs/sway-lend/blob/beta-4/frontend/src/contracts/TokenFactoryAbi.d.ts