Skip to content

Commit f968557

Browse files
pelleclaude
andcommitted
Align JSON schemas and TypeScript types with TAIP-4, TAIP-14, and TAIP-16 specifications
## Schema Updates ### Invoice Schema (TAIP-16) - Complete Rewrite - Rewrite invoice.json to match TAIP-16 specification exactly - Add required fields: id, issueDate, currencyCode, lineItems, total - Update line items structure with id, unitCode, lineTotal, taxCategory - Add UBL-compliant tax structures: taxTotal, taxSubtotal, taxCategory - Add business fields: orderReference, additionalDocumentReference, paymentTerms, accountingCost - Include schema.org Product attributes: name, image, url ### Authorization Messages (TAIP-4) - Fix Reject message schema: correct type URI, add @context/@type, make reason optional - Fix DID/IRI pattern conflicts in base-types.json to resolve validation errors - Update Authorize schema documentation for TAIP-4 compliance ## TypeScript Updates ### TAIP-4 Authorization Flow Alignment - Add settlementAsset and amount fields to Authorize interface per TAIP-4 - Update Settle interface: add required settlementAddress, make settlementId optional - Fix Reject interface: make reason field optional per TAIP-4 specification - Correct CAIP-220 format documentation: eip155:1:tx/ not eip155:1/tx/ ### Validation Results - All test vectors now pass JSON schema validation - TypeScript compilation succeeds without errors - Schemas fully synchronized with latest TAIP specifications 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent d9a3f71 commit f968557

4 files changed

Lines changed: 199 additions & 134 deletions

File tree

packages/typescript/src/tap.ts

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,9 @@ export type Amount = `${number}.${number}` | `${number}`;
189189
* Chain Agnostic Transaction Identifier (CAIP-220)
190190
* Represents a transaction on a specific blockchain in a chain-agnostic way.
191191
*
192-
* Format: `{caip2}/tx/{txid}`
192+
* Format: `{caip2}:tx/{txid}`
193193
*
194-
* @example "eip155:1/tx/0x4a563af33c4871b51a8b108aa2fe1dd5280a30dfb7236170ae5e5e7957eb6392"
194+
* @example "eip155:1:tx/0x4a563af33c4871b51a8b108aa2fe1dd5280a30dfb7236170ae5e5e7957eb6392"
195195
* @see {@link https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-220.md | CAIP-220 Specification}
196196
*/
197197
export type CAIP220 = string;
@@ -722,9 +722,23 @@ export interface Authorize extends TapMessageObject<"Authorize"> {
722722
/**
723723
* Optional settlement address
724724
* Either a blockchain address (CAIP-10) or traditional payment target (RFC 8905 PayTo URI)
725+
* REQUIRED if sent by beneficiary agent and original request lacks settlementAddress role agent
725726
*/
726727
settlementAddress?: SettlementAddress;
727728

729+
/**
730+
* Optional settlement asset
731+
* CAIP-19 identifier specifying the asset for settlement
732+
* REQUIRED when multiple supportedAssets are present in transaction message
733+
*/
734+
settlementAsset?: CAIP19;
735+
736+
/**
737+
* Optional amount
738+
* Decimal representation if different from original transaction amount
739+
*/
740+
amount?: Amount;
741+
728742
/**
729743
* Optional expiration timestamp
730744
* Indicates when the authorization expires
@@ -778,15 +792,22 @@ export interface Connect extends TapMessageObject<"Connect"> {
778792
*/
779793
export interface Settle extends TapMessageObject<"Settle"> {
780794
/**
781-
* Settlement transaction identifier
795+
* Settlement address
796+
* REQUIRED destination address in CAIP-10 or RFC 8905 format
797+
*/
798+
settlementAddress: SettlementAddress;
799+
800+
/**
801+
* Optional settlement transaction identifier
782802
* CAIP-220 identifier for the on-chain settlement transaction
803+
* REQUIRED by at least one agent representing the originator
783804
*/
784-
settlementId: CAIP220;
805+
settlementId?: CAIP220;
785806

786807
/**
787808
* Optional settled amount
788809
* If specified, must be less than or equal to the amount in the original transaction
789-
* If a Complete message specified an amount, this must match that value
810+
* If an Authorize message specified an amount, this must match that value
790811
*/
791812
amount?: Amount;
792813
}
@@ -799,10 +820,10 @@ export interface Settle extends TapMessageObject<"Settle"> {
799820
*/
800821
export interface Reject extends TapMessageObject<"Reject"> {
801822
/**
802-
* Reason for rejection
803-
* Explanation of why the transfer was rejected
823+
* Optional reason for rejection
824+
* Human readable explanation of why the transfer was rejected
804825
*/
805-
reason: string;
826+
reason?: string;
806827
}
807828

808829
/**

schemas/common/base-types.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,16 @@
1111
},
1212
"did": {
1313
"type": "string",
14-
"pattern": "^did:[a-z0-9]+:[a-zA-Z0-9._%-]*[a-zA-Z0-9._%-]$",
14+
"pattern": "^did:[a-z0-9]+:.+$",
1515
"description": "Decentralized Identifier (DID) format"
1616
},
1717
"iri": {
1818
"type": "string",
19-
"format": "iri",
20-
"description": "Internationalized Resource Identifier"
19+
"pattern": "^[a-zA-Z][a-zA-Z0-9+.-]*:.+$",
20+
"not": {
21+
"pattern": "^did:"
22+
},
23+
"description": "Internationalized Resource Identifier (IRI), excluding DIDs"
2124
},
2225
"iso8601DateTime": {
2326
"type": "string",

0 commit comments

Comments
 (0)