ExecuteScriptAtBlockHeight Access API Method
पैरामीटर
Script
डोरी
आवश्यक
लोड हो रहा है...
Arguments
डोरी
आवश्यक
लोड हो रहा है...
BlockHeight
डोरी
आवश्यक
लोड हो रहा है...
रिटर्न
कीमत
डोरी
लोड हो रहा है...
अनुरोध
1पैकेज मुख्य23आयात (4"प्रसंग"5"एनकोडिंग/जेसन"6"एफएमटी"7"लकड़ी का लट्ठा"8"strconv"9)1011समारोह मुख्य ( ) {1213// Requires authenticating before making the request. Refer to Intro Page on how Authentication can be done.14client, err := getAccessClientWithBasicAuth("ENDPOINT-NAME", "TOKEN_GOES_HERE")15ctx := context.Background()16यदि त्रुटि != शून्य {17log.Fatalf("err: %v", err)18}1920// Execute script at latest block21script := []byte(`22pub fun main(a: Int): Int {23return a + 1024}25`)2627// Convert integer to JSON-CDC (Cadence JSON)28arg := 1029// JSON-CDC representation of an integer is a JSON object with "type" and "value" fields30jsonCDC := fmt.Sprintf(`{"type":"Int","value":"%s"}`, strconv.Itoa(arg))3132// Create script arguments33args := [][]byte{[]byte(jsonCDC)}3435// Execute script at Block Height36valueHeightResp, err := client.ExecuteScriptAtBlockHeight(ctx, &access.ExecuteScriptAtBlockHeightRequest{Script: script, Arguments: args, BlockHeight: 54774078})37respJSON, err := json.Marshal(valueHeightResp)38यदि त्रुटि != शून्य {39log.Fatal("execute script at block height failed: ", err)40}41fmt.Println("ExecuteScriptAtBlockHeight response:", string(respJSON))42}
1पैकेज मुख्य23आयात (4"प्रसंग"5"एनकोडिंग/जेसन"6"एफएमटी"7"लकड़ी का लट्ठा"8"strconv"9)1011समारोह मुख्य ( ) {1213// Requires authenticating before making the request. Refer to Intro Page on how Authentication can be done.14client, err := getAccessClientWithBasicAuth("ENDPOINT-NAME", "TOKEN_GOES_HERE")15ctx := context.Background()16यदि त्रुटि != शून्य {17log.Fatalf("err: %v", err)18}1920// Execute script at latest block21script := []byte(`22pub fun main(a: Int): Int {23return a + 1024}25`)2627// Convert integer to JSON-CDC (Cadence JSON)28arg := 1029// JSON-CDC representation of an integer is a JSON object with "type" and "value" fields30jsonCDC := fmt.Sprintf(`{"type":"Int","value":"%s"}`, strconv.Itoa(arg))3132// Create script arguments33args := [][]byte{[]byte(jsonCDC)}3435// Execute script at Block Height36valueHeightResp, err := client.ExecuteScriptAtBlockHeight(ctx, &access.ExecuteScriptAtBlockHeightRequest{Script: script, Arguments: args, BlockHeight: 54774078})37respJSON, err := json.Marshal(valueHeightResp)38यदि त्रुटि != शून्य {39log.Fatal("execute script at block height failed: ", err)40}41fmt.Println("ExecuteScriptAtBlockHeight response:", string(respJSON))42}
अब तक कोई खाता नहीं है?
अपना बनाएँ Quicknode endpoint कुछ ही सेकंड में निर्माण शुरू करें
मुफ़्त में शुरुआत करें