Skip to content

Commit

Permalink
Make SEP-31 transfer fields optional (#143)
Browse files Browse the repository at this point in the history
* Make SEP-31 tranfer fields optional

* Bump version
  • Loading branch information
philipliu authored Aug 15, 2024
1 parent 144fe99 commit 2364549
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion @stellar/anchor-tests/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@stellar/anchor-tests",
"version": "0.6.12",
"version": "0.6.13",
"description": "stellar-anchor-tests is a library and command line interface for testing Stellar anchors.",
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
Expand Down
10 changes: 2 additions & 8 deletions @stellar/anchor-tests/src/schemas/sep31.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const postTransactionsSchema = {
type: "string",
},
},
required: ["id", "stellar_memo", "stellar_memo_type", "stellar_memo"],
required: ["id"],
additionalProperties: false,
};

Expand Down Expand Up @@ -87,13 +87,7 @@ export const getTransactionSchema = {
type: "boolean",
},
},
required: [
"id",
"status",
"stellar_account_id",
"stellar_memo",
"stellar_memo_type",
],
required: ["id", "status"],
},
},
required: ["transaction"],
Expand Down
8 changes: 6 additions & 2 deletions @stellar/anchor-tests/src/tests/sep31/transactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,9 @@ const canCreateTransaction: Test = {
return result;
}
try {
Keypair.fromPublicKey(responseBody.stellar_account_id);
if (responseBody.stellar_account_id) {
Keypair.fromPublicKey(responseBody.stellar_account_id);
}
} catch {
result.failure = makeFailure(this.failureModes.INVALID_SCHEMA, {
errors: "'stellar_acocunt_id' must be a valid Stellar public key",
Expand All @@ -267,7 +269,9 @@ const canCreateTransaction: Test = {
memoValue = Buffer.from(responseBody.stellar_memo, "base64");
}
try {
new Memo(responseBody.stellar_memo_type, memoValue);
if (memoValue) {
new Memo(responseBody.stellar_memo_type, memoValue);
}
} catch {
result.failure = makeFailure(this.failureModes.INVALID_SCHEMA, {
errors: "invalid 'stellar_memo' for 'stellar_memo_type'",
Expand Down
2 changes: 1 addition & 1 deletion server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@
"winston": "^3.3.3"
},
"peerDependencies": {
"@stellar/anchor-tests": "0.6.12"
"@stellar/anchor-tests": "0.6.13"
}
}

0 comments on commit 2364549

Please sign in to comment.