Skip to content

Commit

Permalink
Fix variables typos
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagodeev committed Jun 25, 2024
1 parent a116434 commit 24c02ed
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
15 changes: 8 additions & 7 deletions examples/deployContractUDC/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ func main() {

// Load variables from '.env' file
rpcProviderUrl := setup.GetRpcProviderUrl()
account_addr := setup.GetAccountAddress()
account_cairo_version := setup.GetAccountCairoVersion()
accountAddress := setup.GetAccountAddress()
accountCairoVersion := setup.GetAccountCairoVersion()
privateKey := setup.GetPrivateKey()
public_key := setup.GetPublicKey()
publicKey := setup.GetPublicKey()

// Initialize connection to RPC provider
client, err := rpc.NewProvider(rpcProviderUrl)
Expand All @@ -45,7 +45,7 @@ func main() {
}

// Here we are converting the account address to felt
account_address, err := utils.HexToFelt(account_addr)
accountAddressInFelt, err := utils.HexToFelt(accountAddress)
if err != nil {
panic(err)
}
Expand All @@ -56,7 +56,7 @@ func main() {
if !ok {
panic("Fail to convert privKey to bitInt")
}
ks.Put(public_key, privKeyBI)
ks.Put(publicKey, privKeyBI)

fmt.Println("Established connection with the client")

Expand All @@ -67,7 +67,7 @@ func main() {
}

// Initialize the account
accnt, err := account.NewAccount(client, account_address, public_key, ks, account_cairo_version)
accnt, err := account.NewAccount(client, accountAddressInFelt, publicKey, ks, accountCairoVersion)
if err != nil {
panic(err)
}
Expand Down Expand Up @@ -97,7 +97,7 @@ func main() {
FnCall := rpc.FunctionCall{
ContractAddress: contractAddress, //contractAddress is the contract that we want to call
EntryPointSelector: utils.GetSelectorFromNameFelt(contractMethod), //this is the function that we want to call
Calldata: getUDCCalldata(account_addr), //change this function content to your use case
Calldata: getUDCCalldata(accountAddress), //change this function content to your use case
}

// Building the Calldata with the help of FmtCalldata where we pass in the FnCall struct along with the Cairo version
Expand All @@ -118,6 +118,7 @@ func main() {
setup.PanicRPC(err)
}

fmt.Println("Waiting for the transaction status...")
time.Sleep(time.Second * 3) // Waiting 3 seconds

//Getting the transaction status
Expand Down
6 changes: 3 additions & 3 deletions examples/simpleCall/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func main() {

// Load variables from '.env' file
rpcProviderUrl := setup.GetRpcProviderUrl()
account_addr := setup.GetAccountAddress()
accountAddress := setup.GetAccountAddress()

// Initialize connection to RPC provider
client, err := rpc.NewProvider(rpcProviderUrl)
Expand All @@ -52,7 +52,7 @@ func main() {
}

// Here we are converting the account address to felt
accountAddressInFelt, err := utils.HexToFelt(account_addr)
accountAddressInFelt, err := utils.HexToFelt(accountAddress)
if err != nil {
fmt.Println("Failed to transform the account address, did you give the hex address?")
panic(err)
Expand Down Expand Up @@ -85,5 +85,5 @@ func main() {

// Getting result
balance = balance / (math.Pow(10, decimals))
fmt.Printf("Token balance of %s is %f ETH \n", account_addr, balance)
fmt.Printf("Token balance of %s is %f ETH \n", accountAddress, balance)
}
12 changes: 6 additions & 6 deletions examples/simpleInvoke/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ var (
func main() {
// Load variables from '.env' file
rpcProviderUrl := setup.GetRpcProviderUrl()
account_addr := setup.GetAccountAddress()
account_cairo_version := setup.GetAccountCairoVersion()
accountAddress := setup.GetAccountAddress()
accountCairoVersion := setup.GetAccountCairoVersion()
privateKey := setup.GetPrivateKey()
public_key := setup.GetPublicKey()
publicKey := setup.GetPublicKey()

// Initialize connection to RPC provider
client, err := rpc.NewProvider(rpcProviderUrl)
Expand All @@ -40,16 +40,16 @@ func main() {
if !ok {
panic("Fail to convert privKey to bitInt")
}
ks.Put(public_key, privKeyBI)
ks.Put(publicKey, privKeyBI)

// Here we are converting the account address to felt
accountAddressInFelt, err := utils.HexToFelt(account_addr)
accountAddressInFelt, err := utils.HexToFelt(accountAddress)
if err != nil {
fmt.Println("Failed to transform the account address, did you give the hex address?")
panic(err)
}
// Initialize the account
accnt, err := account.NewAccount(client, accountAddressInFelt, public_key, ks, account_cairo_version)
accnt, err := account.NewAccount(client, accountAddressInFelt, publicKey, ks, accountCairoVersion)
if err != nil {
panic(err)
}
Expand Down

0 comments on commit 24c02ed

Please sign in to comment.