Skip to content

Commit

Permalink
Merge branch 'main' into new-account
Browse files Browse the repository at this point in the history
  • Loading branch information
rianhughes committed Sep 29, 2023
2 parents 5855255 + d336871 commit fe0de12
Show file tree
Hide file tree
Showing 14 changed files with 302 additions and 20 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ name: test
on:
push:
branches:
- '**'
tags-ignore:
- '**'
schedule:
- cron: "42 2 * * *"
pull_request:
branches:
- 'main'

jobs:
build:
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/test_rpc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ on:
push:
branches:
- '**'
tags-ignore:
- '**'
pull_request:
branches:
- 'main'

jobs:
build:
Expand Down
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ operations on the wallets. The package has excellent documentation for a smooth

- library documentation available at [pkg.go.dev](https://pkg.go.dev/github.com/NethermindEth/starknet.go).
- [simple call example](./examples/simpleCall) to make a contract call to a mainnet contract
- [deploy account example](./examples/deployAccount) to deploy a new account contract on testnet.
<!-- Currently not working
- [curve example](./examples/curve) initializing the StarkCurve for signing and verification
- [contract example](./examples/contract) for smart contract deployment and function call
Expand All @@ -70,11 +71,22 @@ cd examples/simpleCall
go mod tidy
go run main.go
```
> Check [here](examples/simpleCall/README.md) for more details
***starknet deployAccount***

```sh
cd examples/deployAccount
go mod tidy
go run main.go
```

> Check [here](examples/deployAccount/README.md) for more details

### RPC

`starknet.go` RPC implements the [Starknet RPC v03 Spec](https://github.com/starkware-libs/starknet-specs/tree/v0.3.0/api):
`starknet.go` RPC implements the [Starknet RPC v04 Spec](https://github.com/starkware-libs/starknet-specs/tree/v0.4.0/api):

| Method | Implemented (*) |
| ------------------------------------------ | ------------------ |
Expand All @@ -91,6 +103,7 @@ go run main.go
| `starknet_getBlockTransactionCount` | :heavy_check_mark: |
| `starknet_call` | :heavy_check_mark: |
| `starknet_estimateFee` | :heavy_check_mark: |
| `starknet_estimateMessageFee` | :heavy_check_mark: |
| `starknet_blockNumber` | :heavy_check_mark: |
| `starknet_blockHashAndNumber` | :heavy_check_mark: |
| `starknet_chainId` | :heavy_check_mark: |
Expand Down
4 changes: 2 additions & 2 deletions contracts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ to them. In particular, you will find:

- A link to the OZ v0.3.2 preset account you might not want to use
- A link to the OZ v0.4.0b preset account you might not want to use
- A link to the Argentlabs/Ledger/Catridge plugin account, you might not want
- A link to the Argentlabs/Ledger/Cartridge plugin account, you might not want
to use either
- The implementation of the `YeaSayer` plugin that always agree on the
transactions and the implementation of the SessionKey plugin that comes with
Expand All @@ -22,7 +22,7 @@ shows how to build those contracts. You should:
- install cairo v0.9.1 with Python 3.9 and run the following commands

```shell
# this command reset the OZ submodule to a version that was providing the v0
# this command resets the OZ submodule to a version that was providing the v0
# account. It is using the cairo v0.9 syntax
make v0 -f MakefileV0
# compile the contracts
Expand Down
2 changes: 1 addition & 1 deletion docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Requests](https://github.com/NethermindEth/starknet.go/pulls) for review by the

We recommend the following work-flow for contributors:

1. **Find an issue** to work on and use comments to communciate your intentions and ask questions.
1. **Find an issue** to work on and use comments to communicate your intentions and ask questions.
2. **Work in a feature branch** of your personal fork (github.com/YOUR_NAME/starknet.go) of the main repository (github.com/NethermindEth/starknet.go).
3. After you have implemented or resolved the issue, **create a pull-request** to merge your changes in the main repository
4. Wait for the repository maintainers to **review your changes** to ensure the issue is addressed.
Expand Down
12 changes: 6 additions & 6 deletions docs/developers.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ know them and you can contribute to the associated projects:
is a project that lists all the existing API and provides some examples
of how to use them.
- There is no true specification of the API we are aware of, however the
implementationis opensource and can be read from the
implementation is opensource and can be read from the
starkware-libs/cairo-lang
[api/gateway directory](https://github.com/starkware-libs/cairo-lang/tree/master/src/starkware/starknet/services/api/gateway)
- Starknet `openrpc` specification is available in the
Expand All @@ -58,16 +58,16 @@ resources available, check:

- [a set of examples](https://github.com/eqlabs/pathfinder/blob/main/crates/pathfinder/rpc_examples.sh)
from the eqlabs/pathfinder project that provides RPC tests with the project.
Note that the [go-ethereum] implementation of openrpc only support positional
Note that the [go-ethereum] implementation of openrpc only supports positional
arguments and, some of these examples must be changed into positional calls.
- `#🦦| starknet.go` channel in the discord from Starknet.

## How to interact with accounts?

An important part of interacting with Starknet consists in interacting
accounts. The reason is that you need go through an account to run transactions,
accounts. The reason is that you need to go through an account to run transactions,
including to create a contract from a class. That is why you should understand
what is an account is and how to interact with it.
what an account is and how to interact with it.

The devil living in the details, there are specificities associated with
account implementations. For instance, you might find that one account does not
Expand All @@ -77,7 +77,7 @@ support the same signature as an other. To start with account, read:
- [Starknet Account Abstraction Model - Part 2](https://community.starknet.io/t/starknet-account-abstraction-model-part-2/839)
- [Learn how to build and deploy Starknet Accounts](https://github.com/starknet-edu/starknet-accounts)
and the companion [Starknet workshop](https://www.youtube.com/watch?v=51Qb3TLpNro)
- Openzeppelin Cairo contracts that includes an account
- Openzeppelin Cairo contracts that include an account
[implementation](https://github.com/OpenZeppelin/cairo-contracts/tree/main/src/openzeppelin/account)
- The argent-x contract
[implementation](https://github.com/argentlabs/argent-contracts-starknet)
Expand All @@ -94,7 +94,7 @@ integration tests and use tools to capture paylods:
mode allows to create a reverse proxy to the API and capture the workload. You
then should be able to run transaction with tools like the Starknet CLI and
better understand that is happening under the hood.
- If you interact from Dapps, like Voyager and want to unrdestand how the
- If you interact from Dapps, like Voyager and want to understand how the
interactions with contract are happening, you can use:
- Chrome [debugging extensions](https://developer.chrome.com/docs/extensions/mv3/tut_debugging/)
- Firefox [debugging extensions](https://extensionworkshop.com/documentation/develop/debugging/)
Expand Down
13 changes: 13 additions & 0 deletions examples/deployAccount/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

This example uses a pre-existing contract on the goerli network to deploy a new account contract. To successfully run this example, you will need: 1) a goerli endpoint, and 2) to fund the precomputed address.

Steps:
1. Rename the ".env.template" file to ".env.testnet"
2. Uncomment, and assign your testnet endpoint to the "INTEGRATION_BASE" variable
3. Execute `go mod tidy` (make sure you are in the "deployAccount" folder)
4. Execute `go run main.go`
5. Fund the precomputed address using a starknet faucet, eg https://faucet.goerli.starknet.io/
6. Press any key, then enter

At this point your account should be deployed on testnet, and you can use a block explorer like [Voyager](https://voyager.online/) to view your transaction using the transaction hash.

36 changes: 36 additions & 0 deletions examples/deployAccount/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
module account

go 1.18

require (
github.com/NethermindEth/juno v0.3.1
github.com/NethermindEth/starknet.go v0.2.1-0.20220620163912-1db2ca279608
github.com/ethereum/go-ethereum v1.10.26
github.com/joho/godotenv v1.4.0
)

replace github.com/NethermindEth/starknet.go => ../../

require (
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect
github.com/bits-and-blooms/bitset v1.7.0 // indirect
github.com/consensys/gnark-crypto v0.11.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/deckarep/golang-set v1.8.0 // indirect
github.com/fxamacker/cbor/v2 v2.4.0 // indirect
github.com/go-ole/go-ole v1.2.1 // indirect
github.com/go-stack/stack v1.8.0 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/gorilla/websocket v1.4.2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect
github.com/stretchr/testify v1.8.1 // indirect
github.com/test-go/testify v1.1.4 // indirect
github.com/tklauser/go-sysconf v0.3.5 // indirect
github.com/tklauser/numcpus v0.2.2 // indirect
github.com/x448/float16 v0.8.4 // indirect
golang.org/x/crypto v0.2.0 // indirect
golang.org/x/sys v0.3.0 // indirect
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
6 changes: 6 additions & 0 deletions examples/deployAccount/go.work
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
go 1.18

use (
.
../..
)
Loading

0 comments on commit fe0de12

Please sign in to comment.