diff --git a/src/walletSdk/Recovery/index.ts b/src/walletSdk/Recovery/index.ts index 2bcd94f..7d7e325 100644 --- a/src/walletSdk/Recovery/index.ts +++ b/src/walletSdk/Recovery/index.ts @@ -33,6 +33,7 @@ import { SponsoringBuilder, Stellar, } from "../Horizon"; +import { camelToSnakeCaseObject } from "../Utils"; // Let's prevent exporting this constructor type as // we should not create this Recovery class directly. @@ -261,13 +262,13 @@ export class Recovery extends AccountRecover { Object.keys(this.servers).map(async (key) => { const server = this.servers[key]; - const accountIdentity = identityMap[key]; + const accountIdentities = identityMap[key]; - if (!accountIdentity) { + if (!accountIdentities) { throw new RecoveryIdentityNotFoundError(key); } - const authToken = this.sep10Auth(key).authenticate({ + const authToken = await this.sep10Auth(key).authenticate({ accountKp: account, walletSigner: server.walletSigner, clientDomain: server.clientDomain, @@ -280,7 +281,9 @@ export class Recovery extends AccountRecover { const resp = await this.httpClient.post( requestUrl, { - identities: accountIdentity, + identities: accountIdentities.map((ai) => + camelToSnakeCaseObject(ai), + ), }, { headers: { diff --git a/test/transaction.test.ts b/test/transaction.test.ts index caa760b..c02b9ce 100644 --- a/test/transaction.test.ts +++ b/test/transaction.test.ts @@ -291,9 +291,7 @@ describe("Path Payment", () => { sendAmount: "5", }) .build(); - sourceKp.sign(txn); - const success = await stellar.submitTransaction(txn); - expect(success).toBe(true); + expect(txn.operations[0].type).toBe("pathPaymentStrictSend"); }, 15000); it("should use path payment receive", async () => { @@ -308,16 +306,14 @@ describe("Path Payment", () => { destAmount: "5", }) .build(); - sourceKp.sign(txn); - const success = await stellar.submitTransaction(txn); - expect(success).toBe(true); + expect(txn.operations[0].type).toBe("pathPaymentStrictReceive"); }, 15000); it("should swap", async () => { const txBuilder = await stellar.transaction({ sourceAddress: sourceKp, }); - const txn = txBuilder.swap(new NativeAssetId(), usdcAsset, "1").build(); + const txn = txBuilder.swap(new NativeAssetId(), usdcAsset, ".1").build(); sourceKp.sign(txn); const success = await stellar.submitTransaction(txn); expect(success).toBe(true);