OSDN Git Service

add get_gm_root_xprv
[bytom/bytom-kit.git] / app / api / resources.py
index 18f7555..ed2120e 100644 (file)
@@ -13,14 +13,17 @@ from app.model.key import xpub_to_public_key
 from app.model.key import xpub_verify
 from app.model.key import xprv_sign
 from app.model.key import xprv_to_xpub
-from app.model.key import xprv_sign
 from app.model.key import xprv_to_child_xprv
 from app.model.key import xpub_to_child_xpub
 from app.model.receiver import create_P2WPKH_program
 from app.model.receiver import create_address
 from app.model.receiver import get_path_from_index
 from app.model.receiver import create_qrcode_base64
-from app.model.transaction import broadcast_transaction
+from app.model.transaction import submit_transaction
+from app.model.key import create_new_key
+from app.model.receiver import create_new_address
+from app.model.transaction import decode_raw_transaction
+from app.model.key_gm import get_gm_root_xprv
 
 
 parser = reqparse.RequestParser()
@@ -189,13 +192,13 @@ class Create_Address(Resource):
         address = create_address(control_program, network)
         return address
 
-class Broadcast_Transaction(Resource):
+class Submit_Transaction(Resource):
 
     def post(self):
         args = parser.parse_args()
         raw_transaction = args.get('raw_transaction_str')
         network = args.get('network_str')
-        response = broadcast_transaction(raw_transaction, network)
+        response = submit_transaction(raw_transaction, network)
         return response
 
 class Create_QRcode_Base64(Resource):
@@ -204,4 +207,38 @@ class Create_QRcode_Base64(Resource):
         args = parser.parse_args()
         s = args.get('s')
         img = create_qrcode_base64(s)
-        return img
\ No newline at end of file
+        return img
+
+class Create_New_Key(Resource):
+
+    def post(self):
+        return create_new_key()
+
+
+class Create_New_Address(Resource):
+
+    def post(self):
+        args = parser.parse_args()
+        xpub = args.get('xpub_str')
+        account_index = args.get('account_index_int')
+        address_index = args.get('address_index_int')
+        change = args.get('change_bool')
+        network = args.get('network_str')
+        response = create_new_address(xpub, account_index, address_index, change, network)
+        return response
+
+class Decode_Raw_Transaction(Resource):
+
+    def post(self):
+        args = parser.parse_args()
+        raw_transaction = args.get('raw_transaction_str')
+        response = decode_raw_transaction(raw_transaction)
+        return response
+
+class Get_Gm_Root_Xprv(Resource):
+
+    def post(self):
+        args = parser.parse_args()
+        seed = args.get('seed_str')
+        root_xprv = get_gm_root_xprv(seed)
+        return root_xprv
\ No newline at end of file