Graffle Flow SDK

The Graffle Flow SDK is a C# SDK that abstracts away the gRPC calls to interact with the Flow blockchain. https://github.com/Graffle/flow-c-sharp-graffle-sdk

Create client:

var flowClientFactory = new FlowClientFactory(nodeName);
var flowClient = flowClientFactory.CreateFlowClient();

Get latest block:

var latestBlock = flowClient.GetLatestBlockAsync();

Get latest sealed block:

var latestBlock = await flowClient.GetLatestBlockAsync(true);

Search a block range for a specific event:

    var eventId = "A.c1e4f4f4c4257510.Market.MomentPurchased";
    ulong startBlock = 22037959;
    ulong endBlock = 22037961;
    var eventsResponse = await flowClient.GetEventsForHeightRangeAsync(eventId, startBlock, endBlock);

Execute script at block id:

    var latestBlockResponse = await this.flowClient.GetLatestBlockAsync(true);

    var helloWorldScript = @"
        pub fun main(): String {
            return ""Hello World""
        }               
    ";
    
    var scriptBytes = Encoding.ASCII.GetBytes(helloWorldScript);
    
    var scriptResponse = await flowClient.ExecuteScriptAtBlockIdAsync(latestBlockResponse.Id.HashToByteString(), scriptBytes, new List<FlowValueType>());
    var metaDataJson = Encoding.Default.GetString(scriptResponse.Value.ToByteArray());
    var result = StringType.FromJson(metaDataJson);

Execute script at block height:

Get block at height

Get a transaction within a block

Get account at block height

Get collection by Id

Create a new account

Send transaction

Last updated