| 167 | } |
| 168 | |
| 169 | async createFromTss(args: { |
| 170 | key: TssKeyType; |
| 171 | chain: string; |
| 172 | network: Network; |
| 173 | password: string; |
| 174 | addressType?: string; |
| 175 | copayerName: string; |
| 176 | }) { |
| 177 | const { key, chain, network, addressType, password } = args; |
| 178 | if (!this.client) { |
| 179 | await this.getClient({ mustExist: true }); |
| 180 | } |
| 181 | const credentials = key.createCredentials(password, { |
| 182 | chain, |
| 183 | network, |
| 184 | account: 0, |
| 185 | addressType |
| 186 | }); |
| 187 | this.client.fromObj(credentials.toObj()); |
| 188 | this.#walletData = { key, credentials: this.client.credentials }; |
| 189 | await this.save(); |
| 190 | // await this.register({ copayerName }); |
| 191 | // this.load calls openWallet which completes the wallet by fetching any missing info |
| 192 | await this.load({ allowCache: true }); |
| 193 | return { key, credentials: this.client.toObj() }; |
| 194 | } |
| 195 | |
| 196 | async register(args: { copayerName: string }) { |
| 197 | if (!this.client) { |