Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New account #302

Merged
merged 69 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
88ef8a2
New account interface
rianhughes Aug 29, 2023
12916f0
Nonce,Sign,Execute methods
rianhughes Aug 30, 2023
a86cf8f
add mocks for rpc provider and update test
rianhughes Aug 30, 2023
80fc14a
SignInvokeTransaction()
rianhughes Aug 30, 2023
ab9b231
Sign test wip
rianhughes Aug 31, 2023
86e5102
EstimateFee
rianhughes Aug 31, 2023
360bbdc
AddInvokeTx
rianhughes Aug 31, 2023
9596d77
Execute - add invoke
rianhughes Aug 31, 2023
81b8b2c
wip
rianhughes Aug 31, 2023
87b49be
tests
rianhughes Aug 31, 2023
65e3e86
transaction hash mateches mainnet
rianhughes Sep 1, 2023
555d1d4
Sign now has orking test
rianhughes Sep 1, 2023
442e461
merge sender address and account address
rianhughes Sep 1, 2023
2481d76
execute wip
rianhughes Sep 1, 2023
68b2c04
wip : devnet tests
rianhughes Sep 1, 2023
1db0988
Devnet test get predeployed accounts
rianhughes Sep 6, 2023
7d407d7
Compile call data wip
rianhughes Sep 6, 2023
6084e33
AddInvoke now works
rianhughes Sep 11, 2023
17352c8
mainnet wip test
rianhughes Sep 11, 2023
b7fab89
testnet addinvoke test wip
rianhughes Sep 11, 2023
750d202
invoke wip : calldata seems correct, sig err
rianhughes Sep 11, 2023
2beb368
wup
rianhughes Sep 11, 2023
118b79d
wip
rianhughes Sep 12, 2023
64d4eed
sig error arises from txhash but fmtCallData and Sign are fine
rianhughes Sep 12, 2023
f834994
sign, callData, txhash tests pass
rianhughes Sep 14, 2023
f0bc92c
AddInvoke Signature error seems to be gone - txhash alrady exists in …
rianhughes Sep 14, 2023
9947191
It worked! 0x55fab87937b8b87ba998cfa5d4495b71f51afa22eb304af62de1efd5…
rianhughes Sep 14, 2023
5e21465
tidy
rianhughes Sep 15, 2023
e1f02fa
tidy test
rianhughes Sep 15, 2023
d5eb44e
Add another test
rianhughes Sep 15, 2023
81fd7cb
ready to tidy test structure
rianhughes Sep 15, 2023
04b3b56
tidied and split TestChainID
rianhughes Sep 15, 2023
a62e0fc
Tidy TestFmtCallData
rianhughes Sep 15, 2023
b265897
tidy TestSignMOCK
rianhughes Sep 15, 2023
c650251
tidy test Txash
rianhughes Sep 18, 2023
c369a96
tidy TestAddInvoke - Tests all finished
rianhughes Sep 18, 2023
80292d4
remove AddInvoke example
rianhughes Sep 18, 2023
8da56b5
implement rpc.provider less write methods
rianhughes Sep 18, 2023
8a4bd3d
Add remaining rpc.provider methods
rianhughes Sep 18, 2023
68111aa
WIP AddDeployAccount Test
rianhughes Sep 18, 2023
90013b8
fixed stupid marshal error
rianhughes Sep 18, 2023
cf53ade
AddDeployAccount Test passes
rianhughes Sep 18, 2023
97e2c29
need merge main for declare test
rianhughes Sep 19, 2023
c92f1cf
merge main
rianhughes Sep 19, 2023
fc1d951
need to figure out compilation
rianhughes Sep 19, 2023
8cf58c6
wip : tests for deployAcnt testnet and hash
rianhughes Sep 19, 2023
d6a1ee7
test for deployAcnt hash and precompute working
rianhughes Sep 19, 2023
be353f5
test for deployAcnt hash and precompute working
rianhughes Sep 19, 2023
48ffd70
Create TransactionHashDeclare and test - no hash match
rianhughes Sep 20, 2023
3426f3b
Add last test and methods
rianhughes Sep 20, 2023
73c481b
merge main
rianhughes Sep 22, 2023
f1f12e6
update TransacitonHashInvoke for different txn versions
rianhughes Sep 22, 2023
de96344
TransactionHashInvoke support for v0 + found reference
rianhughes Sep 22, 2023
8582be9
TxnHash deploAcnt check version
rianhughes Sep 22, 2023
58330af
support multiple txn types for declare and deployAcnt hash
rianhughes Sep 22, 2023
99a5b77
Fix stuff
rianhughes Sep 22, 2023
bfad8bb
fix rpc ChainId
rianhughes Sep 22, 2023
b54088f
Merge branch 'main' into new-account
rianhughes Sep 25, 2023
338ef99
rm DeclareTest so account is working
rianhughes Sep 26, 2023
ca9adf2
add workflow
rianhughes Sep 26, 2023
c03906b
fix workflow name typo
rianhughes Sep 26, 2023
62a1b7e
fix account workflow endpoint
rianhughes Sep 26, 2023
1fbd12e
remove unnecessary account version
rianhughes Sep 26, 2023
4068f89
tidy
rianhughes Sep 26, 2023
87f0b2b
Add remaining rpc.Provider methods
rianhughes Sep 26, 2023
b66cab6
tidy
rianhughes Sep 26, 2023
5855255
address comments
rianhughes Sep 29, 2023
fe0de12
Merge branch 'main' into new-account
rianhughes Sep 29, 2023
588bc46
fix merge main conflict
rianhughes Sep 29, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/workflows/test_account.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: account

on:
push:
branches:
- '**'
tags-ignore:
- '**'

jobs:
build:
runs-on: ubuntu-22.04

services:
devnet:
image: shardlabs/starknet-devnet:latest
ports:
- 5050:5050

steps:
- uses: actions/checkout@v3

- name: Set up Go
- uses: actions/setup-go[@v4.1.0](https://github.com/v4.1.0)
with:
go-version-file: go.mod

- name: wait for devnet to be up...
run: ./.bin/devnet.sh

# Test Account on devnet
- name: Test Account on devnet
run: cd account && go test -timeout 600s -v -env devnet .
env:
TESTNET_ACCOUNT_PRIVATE_KEY: ${{ secrets.TESTNET_ACCOUNT_PRIVATE_KEY }}
INTEGRATION_BASE: "http://localhost:5050"

# Test Account on mock
- name: Test Account with mocks
run: cd account && go test -v . -env mock

30 changes: 10 additions & 20 deletions account.go
Original file line number Diff line number Diff line change
Expand Up @@ -339,18 +339,12 @@ func (account *Account) prepFunctionInvokeRPC(ctx context.Context, messageType s
if err != nil {
return nil, err
}
nonceFelt, err := utils.BigIntToFelt(nonce)
if err != nil {
return nil, err
}
s1Felt, err := utils.BigIntToFelt(s1)
if err != nil {
return nil, err
}
s2Felt, err := utils.BigIntToFelt(s2)
if err != nil {
return nil, err
}
nonceFelt := utils.BigIntToFelt(nonce)

s1Felt := utils.BigIntToFelt(s1)

s2Felt := utils.BigIntToFelt(s2)

return &rpc.InvokeTxnV1{
MaxFee: maxFeeFelt,
Version: version,
Expand Down Expand Up @@ -620,14 +614,10 @@ func (account *Account) Deploy(ctx context.Context, classHash string, details ty
if err != nil {
return nil, err
}
saltFelt, err := utils.BigIntToFelt(salt)
if err != nil {
return nil, err
}
uniqueIntFelt, err := utils.BigIntToFelt(uniqueInt)
if err != nil {
return nil, err
}
saltFelt := utils.BigIntToFelt(salt)

uniqueIntFelt := utils.BigIntToFelt(uniqueInt)

lenCalldataFelt, err := utils.HexToFelt(fmt.Sprintf("0x%x", len(calldata)))
if err != nil {
return nil, err
Expand Down
Loading
Loading