import { Provider, Wallet } from 'fuels';
const test = async () => {
const provider = new Provider("https://beta-3.fuel.network/graphql");
const senderWallet = Wallet.fromPrivateKey('0xdbec40d37e64977120a23dc1924fdfdd5f12e1f2221ae5363173937c5d63aef6', provider);
const destinationWallet = Wallet.generate();
const amountToTransfer = 500;
const assetId = '0x0000000000000000000000000000000000000000000000000000000000000000';
try {
const response = await senderWallet.transfer(
destinationWallet.address,
amountToTransfer,
assetId
);
await response.wait();
// Retrieve balances
const receiverBalance = await destinationWallet.getBalance(assetId);
console.log(receiverBalance)
} catch (e) {
console.log(e?.toString())
}
}
test()
version :0.52.0
return
Error: Unknown type “MessageCoin”: {“response”:{“data”:null,“errors”:[{“message”:“Unknown type "MessageCoin"”,“locations”:[{“line”:23,“column”:1}]},{“message”:“Unknown field "txCreatedIdx" on type "Coin".”,“locations”:[{“line”:20,“column”:3}]},{“message”:“Unknown field "coinsToSpend" on type "Query". Did you mean "resourcesToSpend"?”,“locations”:[{“line”:2,“column”:3}]}],“status”:200,“headers”:{}},“request”:{“query”:“query getCoinsToSpend($owner: Address!, $queryPerAsset: [SpendQueryElementInput!]!, $excludedIds: ExcludeInput) {\n coinsToSpend(\n owner: $owner\n queryPerAsset: $queryPerAsset\n excludedIds: $excludedIds\n ) {\n …coinFragment\n …messageCoinFragment\n }\n}\n\nfragment coinFragment on Coin {\n __typename\n utxoId\n owner\n amount\n assetId\n maturity\n blockCreated\n txCreatedIdx\n}\n\nfragment messageCoinFragment on MessageCoin {\n __typename\n sender\n recipient\n nonce\n amount\n assetId\n daHeight\n}”,“variables”:{“owner”:“0x7e40d1abdf7850b3d95c7a22e66f02f12964f799426d15cdb9291ce118b96b67”,“queryPerAsset”:[{“assetId”:“0x0000000000000000000000000000000000000000000000000000000000000000”,“amount”:“501”}],“excludedIds”:{“messages”:,“utxos”:}}}}