@@ -857,6 +857,46 @@ func (c *ChainlinkClient) ReadTxKeys(chain string) (*TxKeys, *http.Response, err
857857 return txKeys , resp .RawResponse , err
858858}
859859
860+ // ReadAptosKeys reads all Aptos keys from the Chainlink node
861+ func (c * ChainlinkClient ) ReadAptosKeys () (* AptosKeys , * resty.Response , error ) {
862+ aptosKeys := & AptosKeys {}
863+ framework .L .Info ().Str (NodeURL , c .Config .URL ).Msg ("Reading Aptos Keys" )
864+ resp , err := c .APIClient .R ().
865+ SetResult (aptosKeys ).
866+ Get ("/v2/keys/aptos" )
867+ if err != nil {
868+ return nil , nil , err
869+ }
870+ if len (aptosKeys .Data ) == 0 {
871+ framework .L .Warn ().Str (NodeURL , c .Config .URL ).Msg ("Found no Aptos Keys on the node" )
872+ }
873+ return aptosKeys , resp , nil
874+ }
875+
876+ // MustReadAptosKeys reads all Aptos keys from the Chainlink node and returns an error if the request is unsuccessful.
877+ func (c * ChainlinkClient ) MustReadAptosKeys () (* AptosKeys , * resty.Response , error ) {
878+ aptosKeys , res , err := c .ReadAptosKeys ()
879+ if err != nil {
880+ return nil , res , err
881+ }
882+ return aptosKeys , res , VerifyStatusCodeWithResponse (res , http .StatusOK )
883+ }
884+
885+ // MustReadAptosAccounts reads all Aptos account addresses from the Chainlink node.
886+ func (c * ChainlinkClient ) MustReadAptosAccounts () ([]string , error ) {
887+ aptosKeys , _ , err := c .MustReadAptosKeys ()
888+ if err != nil {
889+ return nil , err
890+ }
891+
892+ accounts := make ([]string , 0 , len (aptosKeys .Data ))
893+ for _ , key := range aptosKeys .Data {
894+ accounts = append (accounts , key .Attributes .Account )
895+ }
896+
897+ return accounts , nil
898+ }
899+
860900// DeleteTxKey deletes an tx key based on the provided ID
861901func (c * ChainlinkClient ) DeleteTxKey (chain string , id string ) (* http.Response , error ) {
862902 framework .L .Info ().Str (NodeURL , c .Config .URL ).Str ("ID" , id ).Msg ("Deleting Tx Key" )
0 commit comments