// https://github.com/trezor/connect/blob/develop/src/js/plugins/stellar/plugin.js /** * Transforms StellarSdk.Signer to TrezorConnect.StellarTransaction.Signer * @param {StellarSdk.Signer} signer * @returns { type: 1 | 2 | 3, key: string, weight: number } */ const transformSigner = (signer) => { let type = 0; let key; const weight = signer.weight; if (typeof signer.ed25519PublicKey === 'string') { const keyPair = StellarSdk.Keypair.fromPublicKey(signer.ed25519PublicKey); key = keyPair.rawPublicKey().toString('hex'); } if (signer.preAuthTx instanceof Buffer) { type = 1; key = signer.preAuthTx.toString('hex'); } if (signer.sha256Hash instanceof Buffer) { type = 2; key = signer.sha256Hash.toString('hex'); } return { type, key, weight, }; }