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