(self, params: object = {})
| 635 | return response |
| 636 | |
| 637 | def change_api_key(self, params: object = {}): |
| 638 | apiKeyIndex = None |
| 639 | apiKeyIndex, params = self.handle_api_key_index(params, 'changeApiKey', 'apiKeyIndex', 'api_key_index') |
| 640 | accountIndex = None |
| 641 | accountIndex, params = self.handle_account_index(params, 'changeApiKey', 'accountIndex', 'account_index') |
| 642 | strAccountIndex = self.number_to_string(accountIndex) |
| 643 | strApiKeyIndex = self.number_to_string(apiKeyIndex) |
| 644 | signerNotLoad = self.options['auths'][strAccountIndex][strApiKeyIndex]['signer'] |
| 645 | privateKey, publicKey = self.lighter_generate_api_key(signerNotLoad) |
| 646 | nonce = self.fetch_nonce(accountIndex, apiKeyIndex, self.extend(params, {'skipNonce': False})) |
| 647 | signRaw = { |
| 648 | 'pubkey': self.encode(publicKey), |
| 649 | 'nonce': nonce, |
| 650 | 'api_key_index': apiKeyIndex, |
| 651 | 'account_index': accountIndex, |
| 652 | } |
| 653 | # create lighter client |
| 654 | signer = self.lighter_create_client(signerNotLoad, self.options['chainId'], privateKey, apiKeyIndex, accountIndex) |
| 655 | txType, txInfo, messageToSign = self.lighter_sign_change_pubkey(signer, self.extend(signRaw, params)) |
| 656 | newTxInfo = self.sign_l1_and_prepare_tx_info(txInfo, messageToSign, self.privateKey) |
| 657 | request = { |
| 658 | 'tx_type': txType, |
| 659 | 'tx_info': newTxInfo, |
| 660 | } |
| 661 | self.publicPostSendTx(request) |
| 662 | self.options['auths'][strAccountIndex][strApiKeyIndex]['lighterPrivateKey'] = privateKey |
| 663 | self.options['auths'][strAccountIndex][strApiKeyIndex]['signer'] = signer # reassign signer in go |
| 664 | self.handle_builder_fee_approval(accountIndex, apiKeyIndex) |
| 665 | return signer |
| 666 | |
| 667 | def set_sandbox_mode(self, enable: bool): |
| 668 | super(lighter, self).set_sandbox_mode(enable) |
no test coverage detected