示例#1
0
    def create(self, session_obj, words):
        """Create and register a new wallet"""
        if words == 24:
            self._mnemonic = gdk.generate_mnemonic()
        elif words == 12:
            self._mnemonic = gdk.generate_mnemonic_12()
        else:
            raise click.ClickException("Unsupported number of words")

        assert len(self._mnemonic.split()) == words
        return self.register(session_obj)
示例#2
0
 def create_new_wallet(cls, create_with_2fa_enabled, mnemonic=None):
     self = cls()
     # You can pass in a mnemonic generated outside GDK if you want, or have
     # GDK generate it for you by omitting it. 2FA is enabled if chosen and
     # can be enabled/disabled at any point.
     self.mnemonic = mnemonic or gdk.generate_mnemonic()
     # Session network name options are: testnet, mainnet.
     self.session = gdk.Session({'name': 'testnet'})
     self.session.register_user({}, self.mnemonic).resolve()
     credentials = {'mnemonic': self.mnemonic, 'password': ''}
     self.session.login_user({}, credentials).resolve()
     self.fetch_block_height()
     if create_with_2fa_enabled:
         self.twofactor_auth_enabled(True)
     return self
示例#3
0
 def create_new_wallet(cls, create_with_2fa_enabled, mnemonic=None):
     self = cls()
     # Create a new wallet with a Managed Assets account.
     # You can pass in a mnemonic generated outside GDK if you want, or have
     # GDK generate it for you by omitting it. 2FA is enabled if chosen and
     # can be enabled/disabled at any point.
     self.mnemonic = mnemonic or gdk.generate_mnemonic()
     # Set the network name to 'liquid' for the live Liquid network.
     # There is currently no test Liquid network.
     self.session = gdk.Session({'name': 'liquid'})
     self.session.register_user({}, self.mnemonic).resolve()
     credentials = {'mnemonic': self.mnemonic, 'password': ''}
     self.session.login_user({}, credentials).resolve()
     self.session.create_subaccount({'name': self.SUBACCOUNT_NAME, 'type': self.AMP_ACCOUNT_TYPE}).resolve()
     if create_with_2fa_enabled:
         self.twofactor_auth_enabled(True)
     return self
示例#4
0
 def create(self, session_obj):
     """Create and register a new wallet"""
     self._mnemonic = gdk.generate_mnemonic()
     return self.register(session_obj)
示例#5
0
 def create(self, session_obj):
     """Create and register a new wallet"""
     logging.warning("Generating mnemonic using gdk")
     self._mnemonic = gdk.generate_mnemonic()
     return self.register(session_obj)