From 40f044e1e3f5a6b8a995208b6a03da8599ef0138 Mon Sep 17 00:00:00 2001 From: Philip Liu <12836897+philipliu@users.noreply.github.com> Date: Thu, 2 Nov 2023 17:06:32 -0400 Subject: [PATCH] SEP-6: Make account_id optional in withdraw response (#133) --- @stellar/anchor-tests/package.json | 2 +- @stellar/anchor-tests/src/schemas/sep6.ts | 2 +- @stellar/anchor-tests/src/tests/sep6/withdraw.ts | 4 +++- server/package.json | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/@stellar/anchor-tests/package.json b/@stellar/anchor-tests/package.json index d6e2f97..b495265 100644 --- a/@stellar/anchor-tests/package.json +++ b/@stellar/anchor-tests/package.json @@ -1,6 +1,6 @@ { "name": "@stellar/anchor-tests", - "version": "0.6.8", + "version": "0.6.9", "description": "stellar-anchor-tests is a library and command line interface for testing Stellar anchors.", "main": "./lib/index.js", "types": "./lib/index.d.ts", diff --git a/@stellar/anchor-tests/src/schemas/sep6.ts b/@stellar/anchor-tests/src/schemas/sep6.ts index 1a8aa35..fd219b5 100644 --- a/@stellar/anchor-tests/src/schemas/sep6.ts +++ b/@stellar/anchor-tests/src/schemas/sep6.ts @@ -179,7 +179,7 @@ export const withdrawSuccessResponseSchema = { type: "object", }, }, - required: ["account_id", "id"], + required: ["id"], additionalProperties: false, }; diff --git a/@stellar/anchor-tests/src/tests/sep6/withdraw.ts b/@stellar/anchor-tests/src/tests/sep6/withdraw.ts index 39cf619..7f5b40f 100644 --- a/@stellar/anchor-tests/src/tests/sep6/withdraw.ts +++ b/@stellar/anchor-tests/src/tests/sep6/withdraw.ts @@ -434,7 +434,9 @@ export const returnsProperSchemaForKnownAccounts: Test = { this.context.provides.sep6WithdrawTransactionId = responseBody.id || null; if (getWithdrawCall.response.status === 200) { try { - Keypair.fromPublicKey(responseBody.account_id); + if (responseBody.account_id) { + Keypair.fromPublicKey(responseBody.account_id); + } } catch { result.failure = makeFailure(this.failureModes.INVALID_SCHEMA, { errors: "invalid Stellar public key", diff --git a/server/package.json b/server/package.json index f272346..a6af885 100644 --- a/server/package.json +++ b/server/package.json @@ -30,6 +30,6 @@ "winston": "^3.3.3" }, "peerDependencies": { - "@stellar/anchor-tests": "0.6.8" + "@stellar/anchor-tests": "0.6.9" } }