-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: import path error * fix: change env from string to enum * fix: add opbnb & support set default account
- Loading branch information
1 parent
fd27365
commit 68430e8
Showing
6 changed files
with
82 additions
and
28 deletions.
There are no files selected for viewing
This file contains 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,33 @@ | ||
package bsc | ||
|
||
import ( | ||
"github.com/bnb-chain/greenfield-go-sdk/bsctypes" | ||
"github.com/bnb-chain/greenfield-go-sdk/types" | ||
) | ||
|
||
type IAccountClient interface { | ||
SetDefaultAccount(account *bsctypes.BscAccount) | ||
GetDefaultAccount() (*bsctypes.BscAccount, error) | ||
} | ||
|
||
// SetDefaultAccount - Set the default account of the Client. | ||
// | ||
// If you call other APIs without specifying the account, it will be assumed that you are operating on the default | ||
// account. This includes sending transactions and other actions. | ||
// | ||
// - account: The account to be set as the default account, should be created using a private key or a mnemonic phrase. | ||
func (c *Client) SetDefaultAccount(account *bsctypes.BscAccount) { | ||
c.defaultAccount = account | ||
} | ||
|
||
// GetDefaultAccount - Get the default account of the Client. | ||
// | ||
// - ret1: The default account of the Client. | ||
// | ||
// - ret2: Return error when default account doesn't exist, otherwise return nil. | ||
func (c *Client) GetDefaultAccount() (*bsctypes.BscAccount, error) { | ||
if c.defaultAccount == nil { | ||
return nil, types.ErrorDefaultAccountNotExist | ||
} | ||
return c.defaultAccount, nil | ||
} |
This file contains 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 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
Oops, something went wrong.