Skip to content

Commit 77b3497

Browse files
pelleclaude
andcommitted
Update TypeScript package v1.11.0 with enhanced transaction constraints validation
- Enhanced TransactionConstraints interface with allowedBeneficiaries, allowedSettlementAddresses, and allowedAssets fields - Updated Zod validator schemas to validate new constraint fields with proper CAIP-10 and CAIP-19 validation - Added validateTransactionConstraints function for standalone constraint validation - Updated messages.md documentation with enhanced constraint examples - Enhanced transaction-constraints.json schema with comprehensive validation for all constraint types - Updated test vectors to demonstrate new constraint usage patterns - Updated CHANGELOGs to document v1.11.0 release with enhanced transaction constraints 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent e769007 commit 77b3497

9 files changed

Lines changed: 233 additions & 51 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ This changelog focuses on:
2626
- Updated transaction validation requirements to include new constraint checks
2727
- Enhanced test examples to demonstrate new constraint usage
2828
- Added CAIP-10 and CAIP-19 references for address and asset identifier standards
29+
- **Updated JSON Schemas**: Enhanced transaction-constraints.json schema to validate new constraint fields
30+
- **Updated TypeScript Package v1.11.0**: Enhanced TransactionConstraints interface and Zod validators
31+
- See [packages/typescript/CHANGELOG.md](packages/typescript/CHANGELOG.md) for complete details
2932

3033
## [2025-08-21]
3134

messages.md

Lines changed: 86 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,7 +1055,25 @@ The body object must contain:
10551055
"per_transaction": "10000.00",
10561056
"per_day": "50000.00",
10571057
"currency": "USD"
1058-
}
1058+
},
1059+
"allowedBeneficiaries": [
1060+
{
1061+
"@id": "did:example:vendor-1",
1062+
"name": "Approved Vendor 1"
1063+
},
1064+
{
1065+
"@id": "did:example:vendor-2",
1066+
"name": "Approved Vendor 2"
1067+
}
1068+
],
1069+
"allowedSettlementAddresses": [
1070+
"eip155:1:0x742d35Cc6e4dfE2eDFaD2C0b91A8b0780EDAEb58",
1071+
"eip155:1:0x89abcdefabcdefabcdefabcdefabcdefabcdef12"
1072+
],
1073+
"allowedAssets": [
1074+
"eip155:1/slip44:60",
1075+
"eip155:1/erc20:0xA0b86a33E6441b7178bb7094b2c4b6e5066d68B7"
1076+
]
10591077
}
10601078
}
10611079
}
@@ -1094,7 +1112,11 @@ The body object must contain:
10941112
"per_transaction": "5000.00",
10951113
"per_day": "25000.00",
10961114
"currency": "USD"
1097-
}
1115+
},
1116+
"allowedAssets": [
1117+
"eip155:1/erc20:0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
1118+
"eip155:1/erc20:0x6B175474E89094C44Da98b954EedeAC495271d0F"
1119+
]
10981120
}
10991121
}
11001122
}
@@ -1192,12 +1214,32 @@ Requests a connection between agents with specified constraints.
11921214
|-----------|------|----------|---------|-------------|
11931215
| @context | string | Yes | Draft ([TAIP-15]) | JSON-LD context "https://tap.rsvp/schema/1.0" |
11941216
| @type | string | Yes | Draft ([TAIP-15]) | JSON-LD type "https://tap.rsvp/schema/1.0#Connect" |
1195-
| agent | object | No | Draft ([TAIP-15]) | Details of the requesting agent |
1196-
| principal | [Party](#party) | Yes | Draft ([TAIP-15]) | Party object representing the principal the agent acts on behalf of |
1197-
| constraints | object | Yes | Draft ([TAIP-15]) | Transaction constraints for the connection |
1217+
| requester | [Party](#party) | Yes | Draft ([TAIP-15]) | Party object representing the party requesting the connection |
1218+
| principal | [Party](#party) | Yes | Draft ([TAIP-15]) | Party object representing the party the requesting agent acts on behalf of |
1219+
| agents | array | Yes | Draft ([TAIP-15]) | Array of agent objects involved in the connection process |
1220+
| constraints | object | Yes | Draft ([TAIP-15]) | Transaction constraints for the connection (see [constraints table](#transaction-constraints)) |
11981221
| expiry | string | No | Draft ([TAIP-15]) | ISO 8601 datetime indicating when the connection request expires |
11991222
| agreement | string | No | Draft ([TAIP-15]) | URL or identifier of terms agreed to by the principal |
12001223

1224+
#### Transaction Constraints
1225+
1226+
The `constraints` object defines the boundaries and permissions for transactions performed through an established connection:
1227+
1228+
| Attribute | Type | Required | Status | Description |
1229+
|-----------|------|----------|---------|-------------|
1230+
| purposes | array | No | Draft ([TAIP-15]) | Array of [TAIP-13] purpose codes that are allowed |
1231+
| categoryPurposes | array | No | Draft ([TAIP-15]) | Array of [TAIP-13] category purpose codes that are allowed |
1232+
| limits | object | No | Draft ([TAIP-15]) | Financial limits for transactions |
1233+
| limits.per_transaction | string | No | Draft ([TAIP-15]) | Maximum amount per transaction |
1234+
| limits.per_day | string | No | Draft ([TAIP-15]) | Maximum daily total |
1235+
| limits.per_week | string | No | Draft ([TAIP-15]) | Maximum weekly total |
1236+
| limits.per_month | string | No | Draft ([TAIP-15]) | Maximum monthly total |
1237+
| limits.per_year | string | No | Draft ([TAIP-15]) | Maximum yearly total |
1238+
| limits.currency | string | Yes* | Draft ([TAIP-15]) | ISO 4217 currency code (*required if limits are specified) |
1239+
| allowedBeneficiaries | array | No | Draft ([TAIP-15]) | Array of [TAIP-6] Party objects representing approved payment recipients |
1240+
| allowedSettlementAddresses | array | No | Draft ([TAIP-15]) | Array of [CAIP-10] addresses permitted for settlement |
1241+
| allowedAssets | array | No | Draft ([TAIP-15]) | Array of [CAIP-19] asset identifiers that can be transacted |
1242+
12011243
#### Example Connect Message
12021244
```json
12031245
{
@@ -1233,7 +1275,25 @@ Requests a connection between agents with specified constraints.
12331275
"per_transaction": "10000.00",
12341276
"per_day": "50000.00",
12351277
"currency": "USD"
1236-
}
1278+
},
1279+
"allowedBeneficiaries": [
1280+
{
1281+
"@id": "did:example:vendor-1",
1282+
"name": "Approved Vendor 1"
1283+
},
1284+
{
1285+
"@id": "did:example:vendor-2",
1286+
"name": "Approved Vendor 2"
1287+
}
1288+
],
1289+
"allowedSettlementAddresses": [
1290+
"eip155:1:0x742d35Cc6e4dfE2eDFaD2C0b91A8b0780EDAEb58",
1291+
"eip155:1:0x89abcdefabcdefabcdefabcdefabcdefabcdef12"
1292+
],
1293+
"allowedAssets": [
1294+
"eip155:1/slip44:60",
1295+
"eip155:1/erc20:0xA0b86a33E6441b7178bb7094b2c4b6e5066d68B7"
1296+
]
12371297
},
12381298
"agreement": "https://example.com/terms/v2.1"
12391299
}
@@ -1315,7 +1375,20 @@ This flow demonstrates establishing a connection between a B2B service and a VAS
13151375
"per_transaction": "10000.00",
13161376
"per_day": "50000.00",
13171377
"currency": "USD"
1318-
}
1378+
},
1379+
"allowedBeneficiaries": [
1380+
{
1381+
"@id": "did:example:vendor-1",
1382+
"name": "Approved Vendor 1"
1383+
}
1384+
],
1385+
"allowedSettlementAddresses": [
1386+
"eip155:1:0x742d35Cc6e4dfE2eDFaD2C0b91A8b0780EDAEb58"
1387+
],
1388+
"allowedAssets": [
1389+
"eip155:1/slip44:60",
1390+
"eip155:1/erc20:0xA0b86a33E6441b7178bb7094b2c4b6e5066d68B7"
1391+
]
13191392
}
13201393
}
13211394
}
@@ -1426,7 +1499,12 @@ In self-onboarding scenarios, the agent and principal can be the same entity (e.
14261499
"per_transaction": "50000.00",
14271500
"per_day": "250000.00",
14281501
"currency": "USD"
1429-
}
1502+
},
1503+
"allowedAssets": [
1504+
"eip155:1/slip44:60",
1505+
"eip155:1/erc20:0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
1506+
"eip155:1/erc20:0x6B175474E89094C44Da98b954EedeAC495271d0F"
1507+
]
14301508
},
14311509
"agreement": "https://wallet-service.com/terms-of-service/v3.0"
14321510
}

packages/typescript/CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@
22

33
All notable changes to the TypeScript package are documented in this file.
44

5+
## [1.11.0] - 2025-08-23
6+
7+
### Enhanced
8+
- **TAIP-15 Transaction Constraints**: Enhanced TransactionConstraints interface for improved connection security
9+
- Added `allowedBeneficiaries` field: Array of TAIP-6 Party objects for approved payment recipients
10+
- Added `allowedSettlementAddresses` field: Array of CAIP-10 addresses for approved settlement addresses
11+
- Added `allowedAssets` field: Array of CAIP-19 asset identifiers for approved transaction assets
12+
- Enhanced Zod validator schemas to validate new constraint fields
13+
- Added `validateTransactionConstraints()` function for standalone constraint validation
14+
- Updated Connect interface examples and JSDoc documentation
15+
- Comprehensive constraint validation enables granular control over agent connection permissions
16+
517
## [1.10.0] - 2025-08-21
618

719
### Added

packages/typescript/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/typescript/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@taprsvp/types",
3-
"version": "1.10.0",
3+
"version": "1.11.0",
44
"description": "TypeScript types and interfaces for the Transaction Authorization Protocol (TAP)",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

packages/typescript/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ export * from "./invoice";
33
export * from "./currencies";
44
export * from "./purpose_codes";
55
export * from "./nameHash";
6+
export * from "./validator";

packages/typescript/src/validator.ts

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,12 +208,32 @@ export const AuthorizeSchema = TapMessageObjectSchema.merge(z.object({
208208
conditions: z.array(z.record(z.string(), z.unknown())).optional()
209209
}));
210210

211+
/** Transaction Constraints validator */
212+
export const TransactionConstraintsSchema = z.object({
213+
purposes: z.array(PurposeCodeSchema).optional(),
214+
categoryPurposes: z.array(CategoryPurposeCodeSchema).optional(),
215+
limits: z.object({
216+
per_transaction: AmountSchema.optional(),
217+
per_day: AmountSchema.optional(),
218+
per_week: AmountSchema.optional(),
219+
per_month: AmountSchema.optional(),
220+
per_year: AmountSchema.optional(),
221+
currency: CurrencyCodeSchema
222+
}).optional(),
223+
allowedBeneficiaries: z.array(PartySchema).optional(),
224+
allowedSettlementAddresses: z.array(CAIP10Schema).optional(),
225+
allowedAssets: z.array(CAIP19Schema).optional()
226+
});
227+
211228
/** Connect message body validator */
212229
export const ConnectSchema = TapMessageObjectSchema.merge(z.object({
213230
"@type": z.literal("Connect"),
214-
agent: AgentSchema,
215-
capabilities: z.array(z.string()).optional(),
216-
protocols: z.array(z.string()).optional()
231+
requester: PartySchema,
232+
principal: PartySchema,
233+
agents: z.array(AgentSchema),
234+
constraints: TransactionConstraintsSchema,
235+
expiry: ISO8601DateTimeSchema.optional(),
236+
agreement: z.string().url().optional()
217237
}));
218238

219239
/** Settle message body validator */
@@ -373,4 +393,7 @@ export const validateRejectMessage = (message: unknown) => RejectMessageSchema.s
373393
export const validateCancelMessage = (message: unknown) => CancelMessageSchema.safeParse(message);
374394

375395
/** Validates Revert messages */
376-
export const validateRevertMessage = (message: unknown) => RevertMessageSchema.safeParse(message);
396+
export const validateRevertMessage = (message: unknown) => RevertMessageSchema.safeParse(message);
397+
398+
/** Validates Transaction Constraints */
399+
export const validateTransactionConstraints = (constraints: unknown) => TransactionConstraintsSchema.safeParse(constraints);

schemas/data-structures/transaction-constraints.json

Lines changed: 82 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,58 +2,105 @@
22
"$schema": "https://json-schema.org/draft/2020-12/schema",
33
"$id": "https://taips.tap.rsvp/schemas/data-structures/transaction-constraints.json",
44
"title": "TransactionConstraints",
5-
"description": "Constraints on a virtual asset transaction",
5+
"description": "Transaction constraints for TAIP-15 Agent Connection Protocol that define the boundaries and permissions for transactions performed through an established connection",
66
"type": "object",
77
"properties": {
8-
"maxAmount": {
9-
"$ref": "../common/base-types.json#/$defs/amount",
10-
"description": "Maximum transaction amount"
11-
},
12-
"minAmount": {
13-
"$ref": "../common/base-types.json#/$defs/amount",
14-
"description": "Minimum transaction amount"
15-
},
16-
"currency": {
17-
"$ref": "../common/base-types.json#/$defs/iso4217CurrencyCode",
18-
"description": "Currency for amount constraints"
19-
},
20-
"validFrom": {
21-
"$ref": "../common/base-types.json#/$defs/iso8601DateTime",
22-
"description": "Start of validity period"
23-
},
24-
"validUntil": {
25-
"$ref": "../common/base-types.json#/$defs/iso8601DateTime",
26-
"description": "End of validity period"
8+
"purposes": {
9+
"type": "array",
10+
"items": {
11+
"type": "string",
12+
"description": "ISO 20022 External Purpose Code"
13+
},
14+
"description": "Array of TAIP-13 purpose codes that are allowed for transactions"
2715
},
28-
"allowedPurposes": {
16+
"categoryPurposes": {
2917
"type": "array",
3018
"items": {
31-
"type": "string"
19+
"type": "string",
20+
"description": "ISO 20022 External Category Purpose Code"
3221
},
33-
"description": "Allowed transaction purpose codes"
22+
"description": "Array of TAIP-13 category purpose codes that are allowed for transactions"
3423
},
35-
"allowedAssets": {
24+
"limits": {
25+
"type": "object",
26+
"properties": {
27+
"per_transaction": {
28+
"$ref": "../common/base-types.json#/$defs/amount",
29+
"description": "Maximum amount per single transaction"
30+
},
31+
"per_day": {
32+
"$ref": "../common/base-types.json#/$defs/amount",
33+
"description": "Maximum cumulative amount per day"
34+
},
35+
"per_week": {
36+
"$ref": "../common/base-types.json#/$defs/amount",
37+
"description": "Maximum cumulative amount per week"
38+
},
39+
"per_month": {
40+
"$ref": "../common/base-types.json#/$defs/amount",
41+
"description": "Maximum cumulative amount per month"
42+
},
43+
"per_year": {
44+
"$ref": "../common/base-types.json#/$defs/amount",
45+
"description": "Maximum cumulative amount per year"
46+
},
47+
"currency": {
48+
"$ref": "../common/base-types.json#/$defs/iso4217CurrencyCode",
49+
"description": "ISO 4217 currency code for all limits"
50+
}
51+
},
52+
"required": ["currency"],
53+
"additionalProperties": false,
54+
"description": "Financial limits for transactions with time-based constraints"
55+
},
56+
"allowedBeneficiaries": {
3657
"type": "array",
3758
"items": {
38-
"$ref": "../common/caip-types.json#/$defs/caip19"
59+
"$ref": "party.json",
60+
"description": "TAIP-6 Party object representing an approved payment recipient"
3961
},
40-
"description": "Allowed asset types"
62+
"description": "Array of TAIP-6 Party objects representing parties that can receive payments through this connection"
4163
},
42-
"blockedCountries": {
64+
"allowedSettlementAddresses": {
4365
"type": "array",
4466
"items": {
45-
"type": "string",
46-
"pattern": "^[A-Z]{2}$"
67+
"$ref": "../common/caip-types.json#/$defs/caip10",
68+
"description": "CAIP-10 blockchain address"
4769
},
48-
"description": "ISO 3166-1 alpha-2 country codes to block"
70+
"description": "Array of CAIP-10 addresses that are permitted for settlement through this connection"
4971
},
50-
"allowedCountries": {
72+
"allowedAssets": {
5173
"type": "array",
5274
"items": {
53-
"type": "string",
54-
"pattern": "^[A-Z]{2}$"
75+
"$ref": "../common/caip-types.json#/$defs/caip19",
76+
"description": "CAIP-19 asset identifier"
77+
},
78+
"description": "Array of CAIP-19 asset identifiers that can be transacted through this connection"
79+
}
80+
},
81+
"additionalProperties": false,
82+
"examples": [
83+
{
84+
"purposes": ["BEXP", "SUPP"],
85+
"categoryPurposes": ["CASH", "CCRD"],
86+
"limits": {
87+
"per_transaction": "10000.00",
88+
"per_day": "50000.00",
89+
"currency": "USD"
5590
},
56-
"description": "ISO 3166-1 alpha-2 country codes to allow"
91+
"allowedBeneficiaries": [
92+
{
93+
"@id": "did:example:vendor-1",
94+
"name": "Approved Vendor 1"
95+
}
96+
],
97+
"allowedSettlementAddresses": [
98+
"eip155:1:0x742d35Cc6e4dfE2eDFaD2C0b91A8b0780EDAEb58"
99+
],
100+
"allowedAssets": [
101+
"eip155:1/slip44:60",
102+
"eip155:1/erc20:0xA0b86a33E6441b7178bb7094b2c4b6e5066d68B7"
103+
]
57104
}
58-
}
105+
]
59106
}

0 commit comments

Comments
 (0)