@notabene/javascript-sdk 2.8.0-next.4 → 2.8.0-next.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- "use strict";var L=Object.defineProperty;var A=(e,t,r)=>t in e?L(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var o=(e,t,r)=>A(e,typeof t!="symbol"?t+"":t,r);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var c=(e=>(e.PRIVATE="WALLET",e.VASP="VASP",e))(c||{}),m=(e=>(e.NATURAL="natural",e.LEGAL="legal",e.SELF="self",e))(m||{}),u=(e=>(e.EMPTY="empty",e.VERIFY="verify",e.PENDING="pending",e.VERIFIED="verified",e.BANNED="banned",e))(u||{}),E=(e=>(e.ALLOWED="allowed",e.PENDING="pending",e))(E||{}),p=(e=>(e.ASSET="asset",e.DESTINATION="destination",e.COUNTERPARTY="counterparty",e.AGENT="agent",e))(p||{}),a=(e=>(e.COMPLETE="complete",e.RESIZE="resize",e.RESULT="result",e.READY="ready",e.INVALID="invalid",e.ERROR="error",e.CANCEL="cancel",e))(a||{}),f=(e=>(e.SERVICE_UNAVAILABLE="SERVICE_UNAVAILABLE",e.WALLET_CONNECTION_FAILED="WALLET_CONNECTION_FAILED",e.WALLET_NOT_SUPPORTED="WALLET_NOT_SUPPORTED",e.TOKEN_INVALID="TOKEN_INVALID",e))(f||{}),d=(e=>(e.UPDATE="update",e.REQUEST_RESPONSE="requestResponse",e))(d||{}),v=(e=>(e.PENDING="pending",e.FAILED="rejected",e.FLAGGED="flagged",e.VERIFIED="verified",e))(v||{}),I=(e=>(e.SelfDeclaration="self-declaration",e.SIWE="siwe",e.SIWX="siwx",e.EIP191="eip-191",e.EIP712="eip-712",e.EIP1271="eip-1271",e.BIP137="bip-137",e.BIP322="bip-322",e.BIP137_XPUB="xpub",e.TIP191="tip-191",e.ED25519="ed25519",e.XRP_ED25519="xrp-ed25519",e.CIP8="cip-8",e.MicroTransfer="microtransfer",e.Screenshot="screenshot",e.Connect="connect",e))(I||{});class N{constructor(){o(this,"listeners",new Map);o(this,"port");this.handleMessage=this.handleMessage.bind(this)}setPort(t){this.port=t,this.port.onmessage=this.handleMessage,this.port.start()}on(t,r){return this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t).add(r),()=>this.off(t,r)}off(t,r){const i=this.listeners.get(t);i&&(i.delete(r),i.size===0&&this.listeners.delete(t))}handleMessage(t){const r=t.data;if(typeof r=="object"&&r!==null&&"type"in r){const i=r.type,s=this.listeners.get(i);s&&s.forEach(n=>n(r))}}send(t){this.port&&this.port.postMessage(t)}}class g{constructor(t,r,i){o(this,"_url");o(this,"_value");o(this,"_options");o(this,"_errors",[]);o(this,"iframe");o(this,"eventManager");o(this,"modal");this._url=t,this._value=r,this._options=i,this.eventManager=new N,this.on(a.INVALID,s=>{s.type===a.INVALID&&(this._errors=s.errors,this._value=s.value)}),this.on(a.RESIZE,s=>{s.type===a.RESIZE&&this.iframe&&(this.iframe.style.height=`${s.height}px`)})}get url(){return this._url}get value(){return this._value}get options(){return this._options}get errors(){return this._errors}open(){document.location.href=this.url}mount(t){const r=document.querySelector(t);if(!r)throw new Error(`parentID ${t} not found`);this.embed(r)}embed(t,r=!1){var i,s;this.removeEmbed(),this.iframe=document.createElement("iframe"),this.iframe.src=this.url+(r?"":"&embedded=true"),this.iframe.allow="web-share; clipboard-write; hid; bluetooth;",this.iframe.style.width="100%",this.iframe.style.height="0px",this.iframe.style.border="none",this.iframe.style.overflow="hidden",this.iframe.scrolling="no",t.appendChild(this.iframe),window.addEventListener("message",n=>{var l,h;n.source===((l=this.iframe)==null?void 0:l.contentWindow)&&((h=this.eventManager)==null||h.setPort(n.ports[0]))}),(s=(i=this.iframe)==null?void 0:i.contentWindow)==null||s.focus()}removeEmbed(){this.iframe&&this.iframe.remove()}send(t){this.eventManager.send(t)}on(t,r){return this.eventManager.on(t,r)}off(t,r){this.eventManager.off(t,r)}update(t,r){this._value=t,r&&(this._options=r),this.send({type:d.UPDATE,value:t,options:this._options})}completion(){return new Promise((t,r)=>{let i,s,n;function l(){i&&i(),s&&s(),n&&n()}i=this.on(a.COMPLETE,h=>{t(h.response),l()}),s=this.on(a.CANCEL,()=>{r(new Error("User cancelled")),l()}),n=this.on("error",h=>{r(new Error(h.message)),l()})})}async openModal(){this.modal&&this.closeModal(),this.modal=document.createElement("dialog"),this.modal.style.border="none",this.modal.style.backgroundColor="white",this.modal.style.maxWidth="100vw",this.modal.style.maxHeight="100vh",this.modal.style.width="600px",this.modal.style.height="600px",document.body.appendChild(this.modal),this.embed(this.modal,!0);const t=this.on(a.CANCEL,()=>{this.closeModal()}),r=this.on(a.COMPLETE,()=>{this.closeModal()});return this.modal.showModal(),this.modal.addEventListener("click",()=>{this.closeModal()}),this.completion().finally(()=>{t(),r()})}closeModal(){var t;this.modal&&((t=this.modal)==null||t.close(),this.modal.remove(),this.modal=void 0)}async popup(){const t=window.open(this.url,"_blank","popup=true,width=600,height=600");window.addEventListener("message",s=>{var n;s.source===t&&(console.log("received message from popup",s.data),(n=this.eventManager)==null||n.setPort(s.ports[0]))});const r=this.on(a.CANCEL,()=>{t==null||t.close()}),i=this.on(a.COMPLETE,()=>{t==null||t.close()});return this.completion().finally(()=>{r(),i()})}}function _(e){return Object.entries(e).map(([t,r])=>{if(r==null)return;const i=encodeURIComponent(t),s=encodeURIComponent(typeof r=="object"?JSON.stringify(r):String(r));return`${i}=${s}`}).filter(t=>t!==void 0).join("&")}function w(e){const t=e.slice(1);return t?t.split("&").filter(Boolean).reduce((i,s)=>{const[n,l]=s.split("=");return n&&(i[decodeURIComponent(n)]=l?decodeURIComponent(l):""),i},{}):{}}class C{constructor(t){o(this,"nodeUrl");o(this,"authToken");o(this,"uxUrl");o(this,"theme");o(this,"locale");this.uxUrl=t.uxUrl||"https://connect.notabene.id",this.nodeUrl=t.nodeUrl,this.authToken=t.authToken,this.theme=t.theme,this.locale=t.locale}componentUrl(t,r,i,s){const n=new URL(this.uxUrl);n.pathname=t;const l=_({authToken:this.authToken,value:r,configuration:i});return n.hash=l,this.nodeUrl&&n.searchParams.set("nodeUrl",this.nodeUrl),this.theme&&n.searchParams.set("theme",JSON.stringify(this.theme)),this.locale&&n.searchParams.set("locale",this.locale),s&&(s.callback&&n.searchParams.set("callback_url",s.callback),s.redirectUri&&n.searchParams.set("redirect_uri",s.redirectUri)),n.toString()}createComponent(t,r,i,s){return new g(this.componentUrl(t,r,i,s),r,i)}createWithdrawalAssist(t,r,i){return this.createComponent("withdrawal-assist",t,r,i)}createConnectWallet(t,r,i){return this.createComponent("connect",t,r,i)}createDepositRequest(t,r,i){return this.createComponent("deposit-request",t,r,i)}createDepositAssist(t,r,i){return this.createComponent("deposit-assist",t,r,i)}}exports.AgentType=c;exports.CMType=a;exports.EmbeddedComponent=g;exports.ErrorIdentifierCode=f;exports.HMType=d;exports.PersonType=m;exports.ProofStatus=v;exports.ProofTypes=I;exports.Status=u;exports.VASPSearchControl=E;exports.ValidationSections=p;exports.decodeFragmentToObject=w;exports.default=C;
1
+ "use strict";var N=Object.defineProperty;var U=(t,e,n)=>e in t?N(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var a=(t,e,n)=>U(t,typeof e!="symbol"?e+"":e,n);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var p=(t=>(t.PRIVATE="WALLET",t.VASP="VASP",t))(p||{}),E=(t=>(t.NATURAL="natural",t.LEGAL="legal",t.SELF="self",t))(E||{}),f=(t=>(t.EMPTY="empty",t.VERIFY="verify",t.PENDING="pending",t.VERIFIED="verified",t.BANNED="banned",t))(f||{}),w=(t=>(t.ALLOWED="allowed",t.PENDING="pending",t))(w||{}),v=(t=>(t.ASSET="asset",t.DESTINATION="destination",t.COUNTERPARTY="counterparty",t.AGENT="agent",t))(v||{}),l=(t=>(t.COMPLETE="complete",t.RESIZE="resize",t.RESULT="result",t.READY="ready",t.INVALID="invalid",t.ERROR="error",t.CANCEL="cancel",t))(l||{}),g=(t=>(t.SERVICE_UNAVAILABLE="SERVICE_UNAVAILABLE",t.WALLET_CONNECTION_FAILED="WALLET_CONNECTION_FAILED",t.WALLET_NOT_SUPPORTED="WALLET_NOT_SUPPORTED",t.TOKEN_INVALID="TOKEN_INVALID",t))(g||{}),d=(t=>(t.UPDATE="update",t.REQUEST_RESPONSE="requestResponse",t))(d||{}),y=(t=>(t.PENDING="pending",t.FAILED="rejected",t.FLAGGED="flagged",t.VERIFIED="verified",t))(y||{}),A=(t=>(t.SelfDeclaration="self-declaration",t.SIWE="siwe",t.SIWX="siwx",t.EIP191="eip-191",t.EIP712="eip-712",t.EIP1271="eip-1271",t.BIP137="bip-137",t.BIP322="bip-322",t.BIP137_XPUB="xpub",t.TIP191="tip-191",t.ED25519="ed25519",t.XRP_ED25519="xrp-ed25519",t.CIP8="cip-8",t.MicroTransfer="microtransfer",t.Screenshot="screenshot",t.Connect="connect",t))(A||{});class _{constructor(){a(this,"listeners",new Map);a(this,"port");this.handleMessage=this.handleMessage.bind(this)}setPort(e){this.port=e,this.port.onmessage=this.handleMessage,this.port.start()}on(e,n){return this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e).add(n),()=>this.off(e,n)}off(e,n){const r=this.listeners.get(e);r&&(r.delete(n),r.size===0&&this.listeners.delete(e))}handleMessage(e){const n=e.data;if(typeof n=="object"&&n!==null&&"type"in n){const r=n.type,i=this.listeners.get(r);i&&i.forEach(s=>s(n))}}send(e){this.port&&this.port.postMessage(e)}}class C{constructor(e,n,r){a(this,"_url");a(this,"_value");a(this,"_options");a(this,"_errors",[]);a(this,"iframe");a(this,"eventManager");a(this,"modal");this._url=e,this._value=n,this._options=r,this.eventManager=new _,this.on(l.INVALID,i=>{i.type===l.INVALID&&(this._errors=i.errors,this._value=i.value)}),this.on(l.RESIZE,i=>{i.type===l.RESIZE&&this.iframe&&(this.iframe.style.height=`${i.height}px`)})}get url(){return this._url}get value(){return this._value}get options(){return this._options}get errors(){return this._errors}open(){document.location.href=this.url}mount(e){const n=document.querySelector(e);if(!n)throw new Error(`parentID ${e} not found`);this.embed(n)}embed(e,n=!1){var r,i;this.removeEmbed(),this.iframe=document.createElement("iframe"),this.iframe.src=this.url+(n?"":"&embedded=true"),this.iframe.allow="web-share; clipboard-write; hid; bluetooth;",this.iframe.style.width="100%",this.iframe.style.height="0px",this.iframe.style.border="none",this.iframe.style.overflow="hidden",this.iframe.scrolling="no",e.appendChild(this.iframe),window.addEventListener("message",s=>{var o,c;s.source===((o=this.iframe)==null?void 0:o.contentWindow)&&((c=this.eventManager)==null||c.setPort(s.ports[0]))}),(i=(r=this.iframe)==null?void 0:r.contentWindow)==null||i.focus()}removeEmbed(){this.iframe&&this.iframe.remove()}send(e){this.eventManager.send(e)}on(e,n){return this.eventManager.on(e,n)}off(e,n){this.eventManager.off(e,n)}update(e,n){this._value=e,n&&(this._options=n),this.send({type:d.UPDATE,value:e,options:this._options})}completion(){return new Promise((e,n)=>{let r,i,s;function o(){r&&r(),i&&i(),s&&s()}r=this.on(l.COMPLETE,c=>{e(c.response),o()}),i=this.on(l.CANCEL,()=>{n(new Error("User cancelled")),o()}),s=this.on("error",c=>{n(new Error(c.message)),o()})})}async openModal(){this.modal&&this.closeModal(),this.modal=document.createElement("dialog"),this.modal.style.border="none",this.modal.style.backgroundColor="white",this.modal.style.maxWidth="100vw",this.modal.style.maxHeight="100vh",this.modal.style.width="600px",this.modal.style.height="600px",document.body.appendChild(this.modal),this.embed(this.modal,!0);const e=this.on(l.CANCEL,()=>{this.closeModal()}),n=this.on(l.COMPLETE,()=>{this.closeModal()});return this.modal.showModal(),this.modal.addEventListener("click",()=>{this.closeModal()}),this.completion().finally(()=>{e(),n()})}closeModal(){var e;this.modal&&((e=this.modal)==null||e.close(),this.modal.remove(),this.modal=void 0)}async popup(){const e=window.open(this.url,"_blank","popup=true,width=600,height=600");window.addEventListener("message",i=>{var s;i.source===e&&(console.log("received message from popup",i.data),(s=this.eventManager)==null||s.setPort(i.ports[0]))});const n=this.on(l.CANCEL,()=>{e==null||e.close()}),r=this.on(l.COMPLETE,()=>{e==null||e.close()});return this.completion().finally(()=>{n(),r()})}}function S(t){return Object.entries(t).map(([e,n])=>{if(n==null)return;const r=encodeURIComponent(e),i=encodeURIComponent(typeof n=="object"?JSON.stringify(n):String(n));return`${r}=${i}`}).filter(e=>e!==void 0).join("&")}function O(t){const e=t.slice(1);return e?e.split("&").filter(Boolean).reduce((r,i)=>{const[s,o]=i.split("=");return s&&(r[decodeURIComponent(s)]=o?decodeURIComponent(o):""),r},{}):{}}async function u(t){const e=JSON.stringify(t),n=new TextEncoder,r=crypto.getRandomValues(new Uint8Array(32)),i=await crypto.subtle.importKey("raw",r,{name:"AES-GCM"},!1,["encrypt"]),s=crypto.getRandomValues(new Uint8Array(12)),o=await crypto.subtle.encrypt({name:"AES-GCM",iv:s},i,n.encode(e));return{ciphertext:`${h(s)}-${h(o)}`,key:h(r)}}async function M({ciphertext:t,key:e}){const[n,r]=t.split("-"),i=new Uint8Array(atob(e).split("").map(L=>L.charCodeAt(0))),s=m(n),o=m(r),c=await crypto.subtle.importKey("raw",i,{name:"AES-GCM"},!1,["decrypt"]),b=new TextDecoder,I=await crypto.subtle.decrypt({name:"AES-GCM",iv:new Uint8Array(s)},c,o);return JSON.parse(b.decode(I))}function h(t){const e=new Uint8Array(t);let n="";for(let r=0;r<e.length;r++)n+=String.fromCharCode(e[r]);return btoa(n)}function m(t){const e=atob(t),n=new Uint8Array(e.length);for(let r=0;r<e.length;r++)n[r]=e.charCodeAt(r);return n}class R{constructor(e){a(this,"endpoint");this.endpoint=e}async create(e,n){const r=await u(e),i={metadata:n,sealed:r.ciphertext},s=await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!s.ok)throw new Error(`Failed to create connection: ${await s.text()}`);const o=await s.json();return{id:o.id,version:o.version,metadata:n,data:e,key:r.key}}async update(e,n,r){const i=await u(n),s={sealed:i.ciphertext,version:r},o=await fetch(`${this.endpoint}/${e}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!o.ok)throw new Error(`Failed to update connection: ${await o.text()}`);const c=await o.json();return{id:c.id,metadata:c.metadata,version:c.version,data:n,key:i.key}}async get(e,n){const r=await fetch(`${this.endpoint}/${e}`,{method:"GET"});if(!r.ok)throw new Error(`Failed to get connection: ${await r.text()}`);const i=await r.json(),s=i.sealed[i.sealed.length-1],o=await M({ciphertext:s,key:n});return{id:i.id,version:i.version,metadata:i.metadata,data:o,key:n}}async close(e){const n=await fetch(`${this.endpoint}/${e}`,{method:"DELETE"});if(!n.ok)throw new Error(`Failed to close connection: ${await n.text()}`)}}class D{constructor(e){a(this,"nodeUrl");a(this,"authToken");a(this,"uxUrl");a(this,"theme");a(this,"locale");this.uxUrl=e.uxUrl||"https://connect.notabene.id",this.nodeUrl=e.nodeUrl,this.authToken=e.authToken,this.theme=e.theme,this.locale=e.locale}componentUrl(e,n,r,i){const s=new URL(this.uxUrl);s.pathname=e;const o=S({authToken:this.authToken,value:n,configuration:r});return s.hash=o,this.nodeUrl&&s.searchParams.set("nodeUrl",this.nodeUrl),this.theme&&s.searchParams.set("theme",JSON.stringify(this.theme)),this.locale&&s.searchParams.set("locale",this.locale),i&&(i.callback&&s.searchParams.set("callback_url",i.callback),i.redirectUri&&s.searchParams.set("redirect_uri",i.redirectUri)),s.toString()}createComponent(e,n,r,i){return new C(this.componentUrl(e,n,r,i),n,r)}createWithdrawalAssist(e,n,r){return this.createComponent("withdrawal-assist",e,n,r)}createConnectWallet(e,n,r){return this.createComponent("connect",e,n,r)}createDepositRequest(e,n,r){return this.createComponent("deposit-request",e,n,r)}createDepositAssist(e,n,r){return this.createComponent("deposit-assist",e,n,r)}}exports.AgentType=p;exports.CMType=l;exports.ConnectionManager=R;exports.EmbeddedComponent=C;exports.ErrorIdentifierCode=g;exports.HMType=d;exports.PersonType=E;exports.ProofStatus=y;exports.ProofTypes=A;exports.Status=f;exports.VASPSearchControl=w;exports.ValidationSections=v;exports.decodeFragmentToObject=O;exports.default=D;
@@ -290,6 +290,53 @@ export declare interface ComponentResponse {
290
290
  errors: ValidationError[];
291
291
  }
292
292
 
293
+ export declare interface ConnectionData<T extends ComponentRequest> {
294
+ tx: T;
295
+ authToken?: string;
296
+ txOptions?: TransactionOptions;
297
+ }
298
+
299
+ /**
300
+ * Manages encrypted connections using Cloudflare Durable Objects
301
+ */
302
+ export declare class ConnectionManager {
303
+ private endpoint;
304
+ constructor(endpoint: string);
305
+ /**
306
+ * Creates a new encrypted connection
307
+ * @param data The component request data to encrypt and store
308
+ * @param participants Array of participant identifiers
309
+ * @returns Promise resolving to connection details including ID, version, and encryption key
310
+ */
311
+ create<T extends ComponentRequest>(data: ConnectionData<T>, metadata: ConnectionMetadata): Promise<ConnectionResponse<T>>;
312
+ /**
313
+ * Updates an existing connection with new encrypted data
314
+ * @param id Connection ID
315
+ * @param data New data to encrypt and store
316
+ * @param version Current version number
317
+ * @returns Promise resolving to updated connection details including new encryption key
318
+ */
319
+ update<T extends ComponentRequest>(id: UUID, data: ConnectionData<T>, version: number): Promise<ConnectionResponse<T>>;
320
+ /**
321
+ * Retrieves and decrypts connection data
322
+ * @param id Connection ID
323
+ * @param key Encryption key from previous create/update operation
324
+ * @returns Promise resolving to connection details including decrypted data
325
+ */
326
+ get<T extends ComponentRequest>(id: UUID, key: string): Promise<ConnectionResponse<T>>;
327
+ /**
328
+ * Closes a connection
329
+ * @param id Connection ID
330
+ */
331
+ close(id: UUID): Promise<void>;
332
+ }
333
+
334
+ export declare interface ConnectionMetadata {
335
+ nodeUrl?: string;
336
+ participants: string[];
337
+ transactionType: TransactionType;
338
+ }
339
+
293
340
  /**
294
341
  * An object representing options for a Connection Request
295
342
  * @public
@@ -304,6 +351,14 @@ export declare interface ConnectionRequest extends ComponentRequest {
304
351
  asset: TransactionAsset;
305
352
  }
306
353
 
354
+ export declare interface ConnectionResponse<T extends ComponentRequest> {
355
+ id: UUID;
356
+ version: number;
357
+ metadata: ConnectionMetadata;
358
+ data: ConnectionData<T>;
359
+ key: string;
360
+ }
361
+
307
362
  /**
308
363
  * The counterparty of a transaction.
309
364
  * @public
@@ -1458,6 +1513,8 @@ export declare interface TransactionResponse<V> extends ComponentResponse {
1458
1513
  txUpdate?: V1Transaction;
1459
1514
  }
1460
1515
 
1516
+ export declare type TransactionType = 'withdraw' | 'deposit';
1517
+
1461
1518
  /**
1462
1519
  * Transfer Path
1463
1520
  * Represents the path of intermediary VASPs in a transfer
@@ -10,7 +10,7 @@
10
10
  "author": "Notabene <developers@notabene.id>",
11
11
  "license": "MIT",
12
12
  "packageManager": "yarn@4.5.1",
13
- "version": "2.8.0-next.4",
13
+ "version": "2.8.0-next.5",
14
14
  "source": "src/notabene.ts",
15
15
  "main": "dist/cjs/notabene.cjs",
16
16
  "module": "dist/esm/notabene.js",
@@ -290,6 +290,53 @@ export declare interface ComponentResponse {
290
290
  errors: ValidationError[];
291
291
  }
292
292
 
293
+ export declare interface ConnectionData<T extends ComponentRequest> {
294
+ tx: T;
295
+ authToken?: string;
296
+ txOptions?: TransactionOptions;
297
+ }
298
+
299
+ /**
300
+ * Manages encrypted connections using Cloudflare Durable Objects
301
+ */
302
+ export declare class ConnectionManager {
303
+ private endpoint;
304
+ constructor(endpoint: string);
305
+ /**
306
+ * Creates a new encrypted connection
307
+ * @param data The component request data to encrypt and store
308
+ * @param participants Array of participant identifiers
309
+ * @returns Promise resolving to connection details including ID, version, and encryption key
310
+ */
311
+ create<T extends ComponentRequest>(data: ConnectionData<T>, metadata: ConnectionMetadata): Promise<ConnectionResponse<T>>;
312
+ /**
313
+ * Updates an existing connection with new encrypted data
314
+ * @param id Connection ID
315
+ * @param data New data to encrypt and store
316
+ * @param version Current version number
317
+ * @returns Promise resolving to updated connection details including new encryption key
318
+ */
319
+ update<T extends ComponentRequest>(id: UUID, data: ConnectionData<T>, version: number): Promise<ConnectionResponse<T>>;
320
+ /**
321
+ * Retrieves and decrypts connection data
322
+ * @param id Connection ID
323
+ * @param key Encryption key from previous create/update operation
324
+ * @returns Promise resolving to connection details including decrypted data
325
+ */
326
+ get<T extends ComponentRequest>(id: UUID, key: string): Promise<ConnectionResponse<T>>;
327
+ /**
328
+ * Closes a connection
329
+ * @param id Connection ID
330
+ */
331
+ close(id: UUID): Promise<void>;
332
+ }
333
+
334
+ export declare interface ConnectionMetadata {
335
+ nodeUrl?: string;
336
+ participants: string[];
337
+ transactionType: TransactionType;
338
+ }
339
+
293
340
  /**
294
341
  * An object representing options for a Connection Request
295
342
  * @public
@@ -304,6 +351,14 @@ export declare interface ConnectionRequest extends ComponentRequest {
304
351
  asset: TransactionAsset;
305
352
  }
306
353
 
354
+ export declare interface ConnectionResponse<T extends ComponentRequest> {
355
+ id: UUID;
356
+ version: number;
357
+ metadata: ConnectionMetadata;
358
+ data: ConnectionData<T>;
359
+ key: string;
360
+ }
361
+
307
362
  /**
308
363
  * The counterparty of a transaction.
309
364
  * @public
@@ -1458,6 +1513,8 @@ export declare interface TransactionResponse<V> extends ComponentResponse {
1458
1513
  txUpdate?: V1Transaction;
1459
1514
  }
1460
1515
 
1516
+ export declare type TransactionType = 'withdraw' | 'deposit';
1517
+
1461
1518
  /**
1462
1519
  * Transfer Path
1463
1520
  * Represents the path of intermediary VASPs in a transfer