Skip to main content

proposer

A builder function that adds the proposer to a transaction.

The proposer is responsible for providing the proposal key and paying the network fee for the transaction. The proposer key is used to specify the sequence number and prevent replay attacks.

Every transaction requires exactly one proposer.

Read more about transaction roles and signing transactions.

Import

You can import the entire package and access the function:


_10
import * as sdk from "@onflow/sdk"
_10
_10
sdk.proposer(authz)

Or import directly the specific function:


_10
import { proposer } from "@onflow/sdk"
_10
_10
proposer(authz)

Usage


_28
import * as fcl from "@onflow/fcl";
_28
_28
// Using the current user as proposer
_28
await fcl.mutate({
_28
cadence: `
_28
transaction {
_28
prepare(account: AuthAccount) {
_28
log("Hello from proposer!")
_28
}
_28
}
_28
`,
_28
proposer: fcl.authz
_28
});
_28
_28
// Using builder pattern
_28
await fcl.send([
_28
fcl.transaction`
_28
transaction {
_28
prepare(account: AuthAccount) {
_28
log("Transaction executed")
_28
}
_28
}
_28
`,
_28
fcl.proposer(proposerAuthz),
_28
fcl.payer(payerAuthz),
_28
fcl.authorizations([authorizerAuthz]),
_28
fcl.limit(100)
_28
]);

Parameters

authz

  • Type: AccountAuthorization
  • Description: The authorization object for the proposer

_10
export type AccountAuthorization =
_10
| (AuthorizationFn & Partial<InteractionAccount>)
_10
| Partial<InteractionAccount>

Returns

function


Rate this page