Skip to content

Commit

Permalink
tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
rianhughes committed Jul 28, 2023
1 parent 427ddfb commit 37bd009
Showing 1 changed file with 5 additions and 37 deletions.
42 changes: 5 additions & 37 deletions examples/deployAccount/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package main
import (
"context"
"fmt"
"math/big"
"os"

"github.com/NethermindEth/juno/core/felt"
Expand All @@ -15,16 +14,8 @@ import (
)

var (
name string = "testnet"
counterContract string = "0x0331034cbde9af8aef62929b5886b096ae3d11e33e6ca23122669e928d406500"
someMainnetContract string = "0x024dE48Fb640DB135B3dc85ef0FE2789e032FbCA2fca54E58aB8dB93ca22F767"
address string = "0x126dd900b82c7fc95e8851f9c64d0600992e82657388a48d3c466553d4d9246"
feeMargin uint64 = 115
maxPoll int = 100
pollInterval int = 6
compiledOZAccount = "./contracts/account/OZAccount_compiled.json" // update
compiledERC20Contract = "./contracts/erc20/erc20_custom_compiled.json" // update
predeployedClassHash = "0x2794ce20e5f2ff0d40e632cb53845b9f4e526ebd8471983f7dbd355b721d5a"
name string = "testnet"
predeployedClassHash = "0x2794ce20e5f2ff0d40e632cb53845b9f4e526ebd8471983f7dbd355b721d5a"
)

func getRandomKeys() (*felt.Felt, *felt.Felt) {
Expand Down Expand Up @@ -77,22 +68,6 @@ func precomputeAddress(deployerAddress *felt.Felt, salt *felt.Felt, classHash *f

}

// Matches let qwe = computeHashOnElements([0,0,0,0,0,]);
func precomputeAddress_test() (*big.Int, error) {

bigIntArr, err := utils.FeltArrToBigIntArr([]*felt.Felt{
&felt.Zero,
&felt.Zero,
&felt.Zero,
&felt.Zero,
&felt.Zero,
})
if err != nil {
return nil, err
}
return starknetgo.Curve.ComputeHashOnElements(*bigIntArr)
}

// 1. Precompute addresss [Done!]
// 2. Fund account
// 3. Deploy (can use provider or account)
Expand Down Expand Up @@ -120,10 +95,6 @@ func main() {

fmt.Println("precomputedAddress:", precomputedAddress)

test, err := precomputeAddress_test()
testFelt, err := utils.BigIntToFelt(test)
fmt.Println("precomputeAddress_test:", testFelt)

// Create starknet account
fmt.Println("Initialising account")
ks := starknetgo.NewMemKeystore()
Expand All @@ -132,13 +103,8 @@ func main() {
panic(err)
}

// print stuff
fmt.Println("Precomputed address", precomputedAddress)
fmt.Println("pub", pub)
fmt.Println(" account.AccountAddress", account.AccountAddress)
fmt.Println("classHash", classHash)

// At this point you need to add funds to the deployed account in order to use it.
// Fund address
var input string
fmt.Println("The deployed account has to be feeded with ETH to perform transaction.")
fmt.Print("When your account has been funded with the faucet, press any key and enter to continue : ")
Expand All @@ -148,6 +114,8 @@ func main() {
fmt.Println("Initialised account with address:", account.AccountAddress)
fmt.Println("NOTE: Not using account to deployAccount as that method doesn't exist. Going to use provider for now.")

// NEXT: Sign transaction

tx := rpcv02.BroadcastedDeployAccountTransaction{
BroadcastedTxnCommonProperties: rpcv02.BroadcastedTxnCommonProperties{
Nonce: &felt.Zero, // Contract accounts start with nonce zero.
Expand Down

0 comments on commit 37bd009

Please sign in to comment.