Is there a simple working React example?

Hi I can’t seem to get any of the React quickstart examples to work. Does anyone have a simple git repo that is working?

This code

import React, { useState } from "react";
import * as fcl from "@onflow/fcl";
import { send } from "@onflow/sdk"
import * as sdk from "@onflow/sdk"
import * as types from "@onflow/types"
import {resolveCadence} from "@onflow/sdk-resolve-cadence"
import {args, arg} from "@onflow/sdk-build-arguments"

    const sayHello = async () => {
    const builtInteraction = await sdk.build([
        sdk.script`
    pub fun main(int1: Int, int2: Int): Int {
        return int1 + int2
    }
`,
        args([ arg(1, types.Int), arg(2, types.Int) ])
    ]);

    const resolvedInteraction = await sdk.pipe(builtInteraction, [
        resolveCadence
    ]);
    console.log(`resolvedInteraction : `, resolvedInteraction);
    // THE ERROR GETS THROWN BELOW
    const response = await sdk.send(resolvedInteraction, { node: "http://localhost:8081" })
    // const decoded = await sdk.decode(response)
};

(port 8081 is correct)
Produces this error:

index.js:311 Uncaught (in promise) TypeError: First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.
at fromObject (index.js:311)
at from (index.js:137)
at Function.push../node_modules/buffer/index.js.Buffer.from (index.js:149)
at send-execute-script.js:10

I am successfully logged in. When I console log the resolvedInteraction I see this

resolvedInteraction :  
{tag: 2, assigns: {…}, status: "OK", reason: null, accounts: {…}, …}
accountAddr: null
accounts: {}
arguments: {f1291c2va2: {…}, hqhtizez0j: {…}}
assigns: {ix.cadence: ƒ}
authorizations: []
block: {isSealed: null, id: null, height: null}
events: {eventType: null, start: null, end: null}
latestBlock: {isSealed: null}
message: {cadence: null, refBlock: null, computLimit: null, proposer: null, payer: null, …}
params: {}
payer: null
proposer: null
reason: null
status: "OK"
tag: 2
transactionId: null
__proto__: Object

Have you tried Kitty Items example here GitHub - onflow/kitty-items: Based on CryptoKitties, Kitty Items is an example of a full-stack dapp built on Flow.
It offers a fullstack example

1 Like

Ah, cool. I’ll give it a try.

1 Like

Hello @MaxVector , we are looking forward to building something on Flow to help developers. This is a little bit of experiment we are doing, can you join us, we are very happy to have more developers.

2 Likes

This is awesome! Thanks Lsy, I’ll contribute where I can.

1 Like

flow-tools are incredible! :star_struck:

2 Likes

Ok, this is awesome for Fungible Tokens. Is there an actual working NFT example somewhere (with a github repo)?