9
"github.com/onflow/flow/protobuf/go/flow/access"10
"github.com/onflow/flow/protobuf/go/flow/entities"11
« google.golang.grpc »12
« google.golang.grpc »19
func (a *auth) GetRequestMetadata(ctx contexte.Context, uri ...chaîne) (carte[chaîne]chaîne, erreur) {20
return map[string]string{25
func (auth) RequireTransportSecurity() bool {29
func getAccessClientWithXToken(endpoint, token string) (access.AccessAPIClient, error) {30
target := endpoint + ".flow-mainnet.quiknode.pro:8999" 31
client, err := grpc.Dial(target,32
grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{})),33
grpc.WithPerRPCCredentials(&auth{38
return nil, fmt.Errorf("Unable to dial endpoint %w", err)40
return access.NewAccessAPIClient(client), nil44
token := "TOKEN_GOES_HERE"45
ctx := context.Background()47
client, err := getAccessClientWithXToken("ENDPOINT-NAME", token)49
log.Fatalf("Failed to create client: %v", err)54
prepare(signer: AuthAccount) {55
log("Transaction executed")59
latestBlockReq := &access.GetLatestBlockRequest{IsSealed: true}60
latestBlock, err := client.GetLatestBlock(ctx, latestBlockReq)62
log.Fatalf("Failed to get latest block: %v", err)65
payerAddress := []byte("PAYER_ADDRESS_BYTES")66
proposalKeyAddress := []byte("PROPOSAL_KEY_ADDRESS_BYTES")67
authorizerAddress := []byte("AUTHORIZER_ADDRESS_BYTES")69
transaction := &entities.Transaction{71
Arguments: [][]byte{},72
ReferenceBlockId: latestBlock.Block.Id,74
ProposalKey: &entities.Transaction_ProposalKey{75
Address: proposalKeyAddress,80
Authorizers: [][]byte{authorizerAddress},81
PayloadSignatures: []*entities.Transaction_Signature{83
Address: proposalKeyAddress,85
Signature: []byte("PAYLOAD_SIGNATURE"),88
EnvelopeSignatures: []*entities.Transaction_Signature{90
Address: payerAddress,92
Signature: []byte("ENVELOPE_SIGNATURE"),97
sendTxResp, err := client.SendTransaction(ctx, &access.SendTransactionRequest{Transaction: transaction})99
log.Fatalf("Failed to send transaction: %v", err)102
fmt.Printf("Transaction sent successfully!\n")103
fmt.Printf("Transaction ID: %x\n", sendTxResp.Id)104
fmt.Printf("Reference Block ID: %x\n", latestBlock.Block.Id)
9
"github.com/onflow/flow/protobuf/go/flow/access"10
"github.com/onflow/flow/protobuf/go/flow/entities"11
« google.golang.grpc »12
« google.golang.grpc »19
func (a *auth) GetRequestMetadata(ctx contexte.Context, uri ...chaîne) (carte[chaîne]chaîne, erreur) {20
return map[string]string{25
func (auth) RequireTransportSecurity() bool {29
func getAccessClientWithXToken(endpoint, token string) (access.AccessAPIClient, error) {30
target := endpoint + ".flow-mainnet.quiknode.pro:8999" 31
client, err := grpc.Dial(target,32
grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{})),33
grpc.WithPerRPCCredentials(&auth{38
return nil, fmt.Errorf("Unable to dial endpoint %w", err)40
return access.NewAccessAPIClient(client), nil44
token := "TOKEN_GOES_HERE"45
ctx := context.Background()47
client, err := getAccessClientWithXToken("ENDPOINT-NAME", token)49
log.Fatalf("Failed to create client: %v", err)54
prepare(signer: AuthAccount) {55
log("Transaction executed")59
latestBlockReq := &access.GetLatestBlockRequest{IsSealed: true}60
latestBlock, err := client.GetLatestBlock(ctx, latestBlockReq)62
log.Fatalf("Failed to get latest block: %v", err)65
payerAddress := []byte("PAYER_ADDRESS_BYTES")66
proposalKeyAddress := []byte("PROPOSAL_KEY_ADDRESS_BYTES")67
authorizerAddress := []byte("AUTHORIZER_ADDRESS_BYTES")69
transaction := &entities.Transaction{71
Arguments: [][]byte{},72
ReferenceBlockId: latestBlock.Block.Id,74
ProposalKey: &entities.Transaction_ProposalKey{75
Address: proposalKeyAddress,80
Authorizers: [][]byte{authorizerAddress},81
PayloadSignatures: []*entities.Transaction_Signature{83
Address: proposalKeyAddress,85
Signature: []byte("PAYLOAD_SIGNATURE"),88
EnvelopeSignatures: []*entities.Transaction_Signature{90
Address: payerAddress,92
Signature: []byte("ENVELOPE_SIGNATURE"),97
sendTxResp, err := client.SendTransaction(ctx, &access.SendTransactionRequest{Transaction: transaction})99
log.Fatalf("Failed to send transaction: %v", err)102
fmt.Printf("Transaction sent successfully!\n")103
fmt.Printf("Transaction ID: %x\n", sendTxResp.Id)104
fmt.Printf("Reference Block ID: %x\n", latestBlock.Block.Id)