-
Notifications
You must be signed in to change notification settings - Fork 1
Wallet interface #163
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
Merged
Merged
Wallet interface #163
Changes from all commits
Commits
Show all changes
70 commits
Select commit
Hold shift + click to select a range
eeca6f9
wallet interface
sukantoraymond 389ebf1
working example
sukantoraymond b0f59bf
remove unused func
sukantoraymond f68a2c1
lint
sukantoraymond 032be93
lint
sukantoraymond 222aa15
Merge branch 'main' into wallet-interfface
sukantoraymond dce58ba
lint
sukantoraymond 15ff102
account interface
sukantoraymond a357da8
server wallet
sukantoraymond 90b6351
server wallet api
sukantoraymond 9182628
server wallet api
sukantoraymond 3a97bc1
using go sdk
sukantoraymond 20d1693
using go sdk cleanup
sukantoraymond 4832988
modified create account
sukantoraymond ea90578
we have server api
sukantoraymond bc57486
remove unused files
sukantoraymond ad22346
remove unused fields in response
sukantoraymond 6e3a82c
get account
sukantoraymond 68a4c18
Add server wallet API and CLI functionality
sukantoraymond 5de4e0a
fix
sukantoraymond d8b3db1
cleanup
sukantoraymond 294c153
add REST API on top of RPC
sukantoraymond 88904eb
file cleanup
sukantoraymond bfd6479
Remove data/accounts.json from tracking (now in .gitignore)
sukantoraymond 503e1e8
file cleanup
sukantoraymond 944369c
cleanup
sukantoraymond fb92990
reorganize wallet
sukantoraymond 8cb27b9
multi chain signer
sukantoraymond 8a5b2cc
sign tx result
sukantoraymond 4dd6554
sender multichain
sukantoraymond 5d66fee
reorganize wallet dir
sukantoraymond 052434f
Merge branch 'main' into wallet-interfface
sukantoraymond 24351e0
address comments
sukantoraymond 34dcb2c
address comments
sukantoraymond 139bec1
rename wallet
sukantoraymond 26f20b7
address comments
sukantoraymond 6160624
Update tx/tx.go
sukantoraymond bd39276
address comments
sukantoraymond 21a38b5
wallet sdk
sukantoraymond c0efbb4
Merge branch 'wallet-interfface' into reorganized-sdk-wo-server
sukantoraymond 850d1e1
remove unused files
sukantoraymond 94df610
lint
sukantoraymond 3f9ca27
lint
sukantoraymond c6d551f
lint
sukantoraymond 61842ca
lint
sukantoraymond 578247f
lint
sukantoraymond b419716
lint
sukantoraymond 212ba38
lint
sukantoraymond 2ac7a0f
lint
sukantoraymond 476e2c6
lint
sukantoraymond 188dff9
Revert "lint"
sukantoraymond 796f416
lint
sukantoraymond 44df716
lint
sukantoraymond 060399b
lint
sukantoraymond 83ca7ed
lint
sukantoraymond 89a4155
lint
sukantoraymond 6838d48
lint
sukantoraymond 63e86a6
lint
sukantoraymond e6ef9b1
lint
sukantoraymond f09f22d
lint
sukantoraymond 35c9269
lint
sukantoraymond 39a39c4
Merge pull request #177 from ava-labs/reorganized-sdk-wo-server
sukantoraymond 1c891cf
address comments
sukantoraymond 4963e9e
address comments
sukantoraymond bc594f8
lint
sukantoraymond 17588bb
address comments
sukantoraymond b3c5331
address comments
sukantoraymond d90f236
address comments
sukantoraymond 2d2dc8a
remove clients
sukantoraymond 628e243
address comments
sukantoraymond File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright (C) 2025, Ava Labs, Inc. All rights reserved. | ||
// See the file LICENSE for licensing terms. | ||
package account | ||
|
||
import ( | ||
"github.com/ava-labs/avalanchego/vms/secp256k1fx" | ||
|
||
"github.com/ava-labs/avalanche-tooling-sdk-go/network" | ||
) | ||
|
||
// Account represents the interface for different account implementations | ||
type Account interface { | ||
// GetPChainAddress returns the P-Chain address for the given network | ||
GetPChainAddress(network network.Network) (string, error) | ||
|
||
GetKeychain() (*secp256k1fx.Keychain, error) | ||
} | ||
jasonatran marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// Copyright (C) 2025, Ava Labs, Inc. All rights reserved. | ||
// See the file LICENSE for licensing terms. | ||
package account | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/ava-labs/avalanchego/vms/secp256k1fx" | ||
|
||
"github.com/ava-labs/avalanche-tooling-sdk-go/key" | ||
"github.com/ava-labs/avalanche-tooling-sdk-go/network" | ||
) | ||
|
||
// LocalAccount represents a local account implementation | ||
type LocalAccount struct { | ||
*key.SoftKey | ||
felipemadero marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
// NewLocalAccount creates a new LocalAccount | ||
func NewLocalAccount() (Account, error) { | ||
k, err := key.NewSoft() | ||
if err != nil { | ||
return nil, err | ||
} | ||
return &LocalAccount{ | ||
SoftKey: k, | ||
}, nil | ||
} | ||
|
||
func Import(keyPath string) (Account, error) { | ||
felipemadero marked this conversation as resolved.
Show resolved
Hide resolved
|
||
k, err := key.LoadSoft(keyPath) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return &LocalAccount{ | ||
SoftKey: k, | ||
}, nil | ||
} | ||
|
||
func (a *LocalAccount) GetPChainAddress(network network.Network) (string, error) { | ||
if a.SoftKey == nil { | ||
return "", fmt.Errorf("SoftKey not initialized") | ||
} | ||
pchainAddrs, err := a.SoftKey.GetNetworkChainAddress(network, "P") | ||
return pchainAddrs[0], err | ||
} | ||
|
||
func (a *LocalAccount) GetKeychain() (*secp256k1fx.Keychain, error) { | ||
if a.SoftKey == nil { | ||
return nil, fmt.Errorf("SoftKey not initialized") | ||
} | ||
return a.SoftKey.KeyChain(), nil | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.