Hello, I found this on the onflow javascript sdk example. Is this up to date? I read on the onflow website that in order to deploy to testnet I needed to create an account on Faucet.
When I use Blocto it doesn’t seem to connect as well
Also, the example listed here https://docs.onflow.org/guides/dapp-deployment/testnet-deployment/ when using Testnet is with the Go SDK. Is there a Javascript example as well? Also, is there a built out example of how to deploy contracts in Javascript SDK? Thanks again
@Tim@Mackenzie probably can share additional info on new Testnet access documentation @JeffreyDoyle or @qvvg might be able to help with Javascript SDK examples to deploy contracts to Testnet
Thanks unlocked. All of my questions still stand, but my biggest concern is that last part about deploying contracts in Javascript now. When I was a part of the bootcamp during the summer it was done the same way a transaction was sent. Now it looks different because you can deploy multiple contracts to 1 account and I keep getting an error message about “setCode.” I tried looking here Contracts | Cadence but it’s too confusing for me because I can’t find a Javascript example.
My end goal is really just to deploy a contract that mints test NFTs on the testnet, so whatever would help get me there is great hahahah. Thanks again
Deploying contracts from JavaScript is done the same way you did it in the bootcamp, but with a small change to the Cadence code you use in the transaction itself.
Previously, you would have used a transaction like this:
Now that accounts have multi-contract support, your transaction should look something like this:
const CODE =
`transaction(code: String) {
prepare(acct: AuthAccount) {
acct.contracts.add(
name: "Test",
code: code.decodeHex(),
message: "I'm a new contract in an existing account"
)
}
}`
Hi Jacob, I think the error you’re getting about setCode is happening because @onflow/fcl's ‘stored interactions’ have not been updated with this new transaction code. You can still send the transaction without using a ‘stored interaction’ in the meantime. Multi-contract support in Cadence is a recent addition, and we’re working on bringing all the tooling up-to-date.
It’s true that the documentation is lacking good JavaScript examples, at the moment. We’re also working on making a guide for JavaScript developers to follow, using the latest Cadence features!
However it returns an error everytime that the code flag doesn’t exist. I tried updating the CLI and everything. I’m not quite sure what to make of this. Thanks for your help again.