Skip to content

Commit

Permalink
feature: add fcl serialize
Browse files Browse the repository at this point in the history
  • Loading branch information
gregsantos committed Aug 4, 2022
1 parent c528a33 commit 1711137
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 9 deletions.
3 changes: 2 additions & 1 deletion cmds/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ import * as M1 from "./m1"
import * as M2 from "./m2"
import * as US1 from "./us1"
import * as US2 from "./us2"
import * as SERIALIZE from "./serialize"

export const COMMANDS = [LOGIN, LOGOUT, Q1, Q2, M1, M2, US1, US2]
export const COMMANDS = [LOGIN, LOGOUT, Q1, Q2, M1, M2, US1, US2, SERIALIZE]
22 changes: 22 additions & 0 deletions cmds/serialize.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import * as fcl from "@onflow/fcl"
import { yup, nope } from "../util"

export const LABEL = "Serialize"
export const CMD = async () => {
const voucher = await fcl
.serialize([
fcl.transaction`
transaction() {
prepare(acct: AuthAccount) {
log(acct)
}
}
`,
fcl.limit(999),
fcl.proposer(fcl.authz),
fcl.authorizations([fcl.authz]),
fcl.payer(fcl.authz),
])
.then(yup("US-1"))
.catch(nope("US-1"))
}
15 changes: 7 additions & 8 deletions flow/config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as fcl from "@onflow/fcl"
import getConfig from "next/config"

const USE_LOCAL = false
const USE_LOCAL = true
const resolver = async () => ({
appIdentifier: "Awesome App (v0.0)",
nonce: "3037366134636339643564623330316636626239323161663465346131393662",
Expand All @@ -28,6 +28,10 @@ fcl
.put("app.detail.icon", "https://placekitten.com/g/200/200")
.put("service.OpenID.scopes", "email")
.put("fcl.accountProof.resolver", resolver)
.put(
"discovery.authn.endpoint",
"https://fcl-discovery.onflow.org/api/testnet/authn"
)
//.put("fcl.storage", LOCAL_STORAGE)
//.put("discovery.wallet.method", "POP/RPC")

Expand All @@ -47,13 +51,8 @@ if (USE_LOCAL) {
.put("flow.network", "testnet")
.put("accessNode.api", "https://rest-testnet.onflow.org") // grpc: https://access-testnet.onflow.org
.put("discovery.wallet", "https://fcl-discovery.onflow.org/testnet/authn")
// .put("discovery.wallet", "http://localhost:3000/testnet/authn")
// .put("discovery.authn.include", ["0x82ec283f88a62e65"])
.put(
"discovery.authn.endpoint",
"https://fcl-discovery.onflow.org/api/testnet/authn"
)

// .put("discovery.wallet", "http://localhost:3000/testnet/authn")
// .put("discovery.authn.include", ["0x82ec283f88a62e65"])
// mainnet
// .put("flow.network", "mainnet")
// .put("accessNode.api", "https://rest-mainnet.onflow.org")
Expand Down

0 comments on commit 1711137

Please sign in to comment.