Blocto
Search…
Sign Transaction
Sign message with Blocto wallet through Flow Client Library (FCL)
Before sending a transaction, user needs to connect to Blocto wallet first.

Step 1 - Send transaction

1
import * as fcl from "@onflow/fcl"
2
​
3
const SIMPLE_TRANSACTION = `\
4
transaction {
5
execute {
6
log("Hello World!!")
7
}
8
}
9
`
10
​
11
// Get latest block info
12
const blockResponse = await fcl.send([
13
fcl.getLatestBlock(),
14
])
15
​
16
// Decode block info
17
const block = await fcl.decode(blockResponse)
18
​
19
// Send transaction
20
const tx = await fcl.send([
21
fcl.transaction(SIMPLE_TRANSACTION),
22
fcl.proposer(fcl.currentUser().authorization),
23
fcl.payer(fcl.currentUser().authorization),
24
fcl.ref(block.id),
25
])
26
​
Copied!

Step 2 - Monitor transaction result

1
import * as fcl from "@onflow/fcl"
2
​
3
// Monitor transaction result
4
fcl
5
.tx(tx)
6
.subscribe(console.log) // fires everytime tx status updates
7
​
Copied!
Last modified 1yr ago