Skip to content

Commit

Permalink
TxnHash deploAcnt check version
Browse files Browse the repository at this point in the history
  • Loading branch information
rianhughes committed Sep 22, 2023
1 parent de96344 commit 8582be9
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion account/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ func NewAccount(provider rpc.RpcProvider, version uint64, accountAddress *felt.F
return account, nil
}

// TransactionHash2 requires the callData to be compiled beforehand
func (account *Account) TransactionHashInvoke(tx rpc.InvokeTxnType) (*felt.Felt, error) {

// https://docs.starknet.io/documentation/architecture_and_concepts/Network_Architecture/transactions/#deploy_account_hash_calculation
Expand Down Expand Up @@ -184,6 +183,14 @@ func (account *Account) SignDeclareTransaction(ctx context.Context, tx *rpc.Decl

// TransactionHashDeployAccount computes the transaction hash for deployAccount transactions
func (account *Account) TransactionHashDeployAccount(tx rpc.DeployAccountTxn, contractAddress *felt.Felt) (*felt.Felt, error) {

// https://docs.starknet.io/documentation/architecture_and_concepts/Network_Architecture/transactions/#deploy_account_transaction

// There is only version 1 of deployAccount txn
if tx.Version != rpc.TransactionV1 {
return nil, ErrTxnTypeUnSupported
}

Prefix_DEPLOY_ACCOUNT := new(felt.Felt).SetBytes([]byte("deploy_account"))

calldata := []*felt.Felt{tx.ClassHash, tx.ContractAddressSalt}
Expand Down

0 comments on commit 8582be9

Please sign in to comment.