From a6f716da5c32aedea4d61a8a32bad38e4bd624be Mon Sep 17 00:00:00 2001 From: Spencer Stock Date: Tue, 2 Dec 2025 16:16:16 -0700 Subject: [PATCH 1/2] Update DataCallback to event-based structure --- .../core/capabilities/datacallback.mdx | 49 +++++++++++++++---- .../prolink-utilities/decodeProlink.mdx | 4 ++ .../prolink-utilities/encodeProlink.mdx | 5 +- 3 files changed, 47 insertions(+), 11 deletions(-) diff --git a/docs/base-account/reference/core/capabilities/datacallback.mdx b/docs/base-account/reference/core/capabilities/datacallback.mdx index 5ba9d573e..beef69716 100644 --- a/docs/base-account/reference/core/capabilities/datacallback.mdx +++ b/docs/base-account/reference/core/capabilities/datacallback.mdx @@ -25,9 +25,15 @@ type DataCallbackRequestType = { type: DataCallbackType; } +type DataCallbackEvent = { + type: 'initiated' | 'preSign' | 'postSign'; + context?: Record; + requests?: DataCallbackRequestType[]; // Only for preSign events +} + type DataCallbackCapability = { - requests: DataCallbackRequestType[]; callbackURL?: string; + events: DataCallbackEvent[]; } ``` @@ -80,18 +86,32 @@ const response = await provider.request({ ], capabilities: { dataCallback: { - requests: [ + callbackURL: "https://your-api.com/validate", // Your validation endpoint + events: [ { - type: "email", - optional: false, // Whether this field is optional + type: "initiated", + context: { orderId: "123" } // Optional context data }, { - type: "physicalAddress", - optional: true, + type: "preSign", + requests: [ + { + type: "email", + optional: false, // Whether this field is optional + }, + { + type: "physicalAddress", + optional: true, + }, + // Add more requests as needed + ], + context: { shippingTier: "express" } // Optional context data }, - // Add more requests as needed - ], - callbackURL: "https://your-api.com/validate", // Your validation endpoint + { + type: "postSign", + context: { webhookTag: "after" } // Optional context data + } + ] }, }, }], @@ -112,7 +132,16 @@ Your callback API will receive a POST request with the following structure: chainId: string; capabilities: { dataCallback: { - requestedInfo: { + callbackURL: string; + events: Array<{ + type: 'initiated' | 'preSign' | 'postSign'; + context?: Record; + requests?: Array<{ + type: 'email' | 'phoneNumber' | 'physicalAddress' | 'name'; + optional?: boolean; + }>; + }>; + requestedInfo?: { email?: string; phoneNumber?: { number: string; diff --git a/docs/base-account/reference/prolink-utilities/decodeProlink.mdx b/docs/base-account/reference/prolink-utilities/decodeProlink.mdx index 1d8d1d5c0..5734b8e60 100644 --- a/docs/base-account/reference/prolink-utilities/decodeProlink.mdx +++ b/docs/base-account/reference/prolink-utilities/decodeProlink.mdx @@ -161,6 +161,10 @@ async function extractCallbacks(prolink: string) { const callback = decoded.capabilities.dataCallback; console.log('Callback URL:', callback.callbackURL); console.log('Events:', callback.events); + // Events structure: [{ type: 'initiated', context: {...} }, ...] + callback.events?.forEach(event => { + console.log(`Event: ${event.type}`, event.context); + }); return callback; } diff --git a/docs/base-account/reference/prolink-utilities/encodeProlink.mdx b/docs/base-account/reference/prolink-utilities/encodeProlink.mdx index 2204b208a..a45fb49ae 100644 --- a/docs/base-account/reference/prolink-utilities/encodeProlink.mdx +++ b/docs/base-account/reference/prolink-utilities/encodeProlink.mdx @@ -107,7 +107,10 @@ const prolink = await encodeProlink({ capabilities: { dataCallback: { callbackURL: 'https://api.yourapp.com/webhook', - events: ['initiated', 'postSign', 'confirmed'] + events: [ + { type: 'initiated', context: { orderId: '123' } }, + { type: 'postSign', context: { webhookTag: 'after' } } + ] } } }); From 7a479df58bab06e63b889d28494608fc8330d90b Mon Sep 17 00:00:00 2001 From: Spencer Stock Date: Wed, 3 Dec 2025 08:47:17 -0700 Subject: [PATCH 2/2] leave main dataCallback file as is --- .../core/capabilities/datacallback.mdx | 49 ++++--------------- 1 file changed, 10 insertions(+), 39 deletions(-) diff --git a/docs/base-account/reference/core/capabilities/datacallback.mdx b/docs/base-account/reference/core/capabilities/datacallback.mdx index beef69716..5ba9d573e 100644 --- a/docs/base-account/reference/core/capabilities/datacallback.mdx +++ b/docs/base-account/reference/core/capabilities/datacallback.mdx @@ -25,15 +25,9 @@ type DataCallbackRequestType = { type: DataCallbackType; } -type DataCallbackEvent = { - type: 'initiated' | 'preSign' | 'postSign'; - context?: Record; - requests?: DataCallbackRequestType[]; // Only for preSign events -} - type DataCallbackCapability = { + requests: DataCallbackRequestType[]; callbackURL?: string; - events: DataCallbackEvent[]; } ``` @@ -86,32 +80,18 @@ const response = await provider.request({ ], capabilities: { dataCallback: { - callbackURL: "https://your-api.com/validate", // Your validation endpoint - events: [ + requests: [ { - type: "initiated", - context: { orderId: "123" } // Optional context data + type: "email", + optional: false, // Whether this field is optional }, { - type: "preSign", - requests: [ - { - type: "email", - optional: false, // Whether this field is optional - }, - { - type: "physicalAddress", - optional: true, - }, - // Add more requests as needed - ], - context: { shippingTier: "express" } // Optional context data + type: "physicalAddress", + optional: true, }, - { - type: "postSign", - context: { webhookTag: "after" } // Optional context data - } - ] + // Add more requests as needed + ], + callbackURL: "https://your-api.com/validate", // Your validation endpoint }, }, }], @@ -132,16 +112,7 @@ Your callback API will receive a POST request with the following structure: chainId: string; capabilities: { dataCallback: { - callbackURL: string; - events: Array<{ - type: 'initiated' | 'preSign' | 'postSign'; - context?: Record; - requests?: Array<{ - type: 'email' | 'phoneNumber' | 'physicalAddress' | 'name'; - optional?: boolean; - }>; - }>; - requestedInfo?: { + requestedInfo: { email?: string; phoneNumber?: { number: string;